Skip to content

Commit ce88922

Browse files
author
Justin Randell
committed
socketio#169: fix returning 'ws' for location even when the client connects via 'wss'
1 parent 5c4c681 commit ce88922

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/socket.io/transports/websocket.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ WebSocket.prototype._onConnect = function(req, socket){
3333
}
3434

3535
var origin = this.request.headers.origin,
36-
location = (origin && origin.substr(0, 5) == 'https' ? 'wss' : 'ws')
36+
location = (this.request.socket.encrypted ? 'wss' : 'ws')
3737
+ '://' + this.request.headers.host + this.request.url;
3838

3939
this.waitingForNonce = false;

0 commit comments

Comments
 (0)