diff --git a/src/websocket.js b/src/websocket.js index 576ea8a..4b356e6 100644 --- a/src/websocket.js +++ b/src/websocket.js @@ -39,7 +39,12 @@ WSSource.prototype.start = function() { this.progress = 0; this.established = false; - this.socket = new WebSocket(this.url, this.options.protocols || null); + if (this.options.protocols) { + this.socket = new WebSocket(this.url, this.options.protocols); + } + else { + this.socket = new WebSocket(this.url); + } this.socket.binaryType = 'arraybuffer'; this.socket.onmessage = this.onMessage.bind(this); this.socket.onopen = this.onOpen.bind(this);