You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steps to reproduce (if the current behaviour is a bug)
node.js:
global.self={};// - declaring global.self before requiring `websocket.js` will end up with timeout, because of mentioned block of code. // It will try to set BrowserWebSocket = self.WebSocket || self.MozWebSocket; and fail. // now both BrowserWebSocket and NodeWebSocket are undefinedconstSocketIO=require('socket.io-client');constsocket=SocketIO('http://localhost',{transports: ['websocket'],timeout: 5000,reconnection: false,});socket.on('connect',function(){console.log('WS connected');});socket.on('connect_error',function(e){console.log('WS error',e);});
Expected behaviour
NodeWebSocket should not be undefined
Setup
OS: any
nodejs
engine.io version: current
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Mentioned condition is not valid, there should be additional check if BrowserWebSocket is set OR there should better nodejs environment detection (i think typeof self !== 'undefined is not enough)
The text was updated successfully, but these errors were encountered:
You want to:
Current behaviour
According to this pice of code:
https://github.com/socketio/engine.io-client/blob/master/lib/transports/websocket.js#L14-L22
NodeWebSocket
will be required ONLY if global variablesself
andWebSocket
are not defined.Steps to reproduce (if the current behaviour is a bug)
node.js:
Expected behaviour
NodeWebSocket should not be undefined
Setup
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Mentioned condition is not valid, there should be additional check if
BrowserWebSocket
is set OR there should better nodejs environment detection (i thinktypeof self !== 'undefined
is not enough)The text was updated successfully, but these errors were encountered: