diff --git a/lib/index.js b/lib/index.js index 5305ff8..f58bdad 100644 --- a/lib/index.js +++ b/lib/index.js @@ -137,6 +137,7 @@ function authorize(options, onConnection) { return function(socket, accept){ var token, error; + var handshake = data.handshake; var req = socket.request || socket; var authorization_header = (req.headers || {}).authorization; @@ -157,8 +158,11 @@ function authorize(options, onConnection) { } } - //get the token from query string - if (req._query && req._query.token) { + //get the token from handshake or query string + if (handshake && handshake.query.token){ + token = handshake.query.token; + } + else if (req._query && req._query.token) { token = req._query.token; } else if (req.query && req.query.token) {