diff --git a/lib/socket.io/transports/websocket.js b/lib/socket.io/transports/websocket.js index 254db257aa..72f215efa9 100644 --- a/lib/socket.io/transports/websocket.js +++ b/lib/socket.io/transports/websocket.js @@ -33,7 +33,7 @@ WebSocket.prototype._onConnect = function(req, socket){ } var origin = this.request.headers.origin, - location = (origin && origin.substr(0, 5) == 'https' ? 'wss' : 'ws') + location = (this.request.socket.encrypted ? 'wss' : 'ws') + '://' + this.request.headers.host + this.request.url; this.waitingForNonce = false;