Skip to content

Commit

Permalink
Enable WebSocket to accept sub-protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
cxa committed Feb 21, 2017
1 parent 45cd708 commit bbbaf84
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ JSMpeg.Source.WebSocket = (function(){ "use strict";

var WSSource = function(url, options) {
this.url = url;
this.options = options;
this.socket = null;

this.callbacks = {connect: [], data: []};
Expand Down Expand Up @@ -34,7 +35,7 @@ WSSource.prototype.start = function() {
this.progress = 0;
this.established = false;

this.socket = new WebSocket(this.url);
this.socket = new WebSocket(this.url, this.options.protocols || '');
this.socket.binaryType = 'arraybuffer';
this.socket.onmessage = this.onMessage.bind(this);
this.socket.onopen = this.onOpen.bind(this);
Expand Down

0 comments on commit bbbaf84

Please sign in to comment.