Skip to content

Commit bbbaf84

Browse files
committed
Enable WebSocket to accept sub-protocols
1 parent 45cd708 commit bbbaf84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/websocket.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ JSMpeg.Source.WebSocket = (function(){ "use strict";
22

33
var WSSource = function(url, options) {
44
this.url = url;
5+
this.options = options;
56
this.socket = null;
67

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

37-
this.socket = new WebSocket(this.url);
38+
this.socket = new WebSocket(this.url, this.options.protocols || '');
3839
this.socket.binaryType = 'arraybuffer';
3940
this.socket.onmessage = this.onMessage.bind(this);
4041
this.socket.onopen = this.onOpen.bind(this);

0 commit comments

Comments
 (0)