Skip to content

Commit

Permalink
Merge pull request phoboslab#133 from cxa/master
Browse files Browse the repository at this point in the history
Enable WebSocket to accept sub-protocols
  • Loading branch information
phoboslab authored Feb 22, 2017
2 parents 8dda7d2 + bbbaf84 commit 9aa4cac
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 9aa4cac

Please sign in to comment.