Websocket fails with 'transport error' if protocol not set
stormbkk87 opened this issue · comments
You want to:
Expose the 'protocols' option for the Websocket transport. Some Websocket implementations require the protocols parameter or will fail connection.
The "ws" npm object for Node has 3 constructor parameters:
constructor (address, protocols, options)
- report a bug
- request a feature
Current behaviour
var protocols = void (0); <--Oh no, hardcoding!
Steps to reproduce (if the current behaviour is a bug)
Communicating with a socket.io server that requires a protocol option will fail with "transport error".
Expected behaviour
function WS (opts) {
var forceBase64 = (opts && opts.forceBase64);
if (forceBase64) {
this.supportsBinary = false;
}
this.perMessageDeflate = opts.perMessageDeflate;
this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;
this.protocols = opts.protocols || void (0);
if (!this.usingBrowserWebSocket) {
WebSocket = NodeWebSocket;
}
Transport.call(this, opts);
}
Setup
- OS: All
- browser: Node
- engine.io version: Current
Other information (e.g. stacktraces, related issues, suggestions how to fix)
Closed by #546.