Skip to content

Commit

Permalink
Allow disabling websocket_protocol by passing a falsy option (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsOnlyBinary authored Feb 17, 2022
1 parent 2bc7f40 commit af14f5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/transports/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ module.exports = class Connection extends EventEmitter {
this.incoming_buffer = '';

this.protocol_fallback = false;
this.protocol = options.websocket_protocol;

// JSON does not allow undefined and websocket protocol does not allow falsy
// if the protocol is falsy then the user intends no protocol, so set to undefined
this.protocol = options.websocket_protocol ?
options.websocket_protocol :
undefined;
}

isConnected() {
Expand Down

0 comments on commit af14f5a

Please sign in to comment.