Commit 082027dc authored by samhed's avatar samhed

Sync with websockify

Pull 90b519edf0c1857d
parent 60a415ae
...@@ -262,7 +262,7 @@ function on(evt, handler) { ...@@ -262,7 +262,7 @@ function on(evt, handler) {
eventHandlers[evt] = handler; eventHandlers[evt] = handler;
} }
function init(protocols, ws_schema) { function init(protocols) {
rQ = []; rQ = [];
rQi = 0; rQi = 0;
sQ = []; sQ = [];
...@@ -278,14 +278,11 @@ function init(protocols, ws_schema) { ...@@ -278,14 +278,11 @@ function init(protocols, ws_schema) {
bt = true; bt = true;
} }
// Check for full binary type support in WebSocket // Check for full binary type support in WebSockets
// Inspired by: // TODO: this sucks, the property should exist on the prototype
// https://github.com/Modernizr/Modernizr/issues/370 // but it does not.
// https://github.com/Modernizr/Modernizr/blob/master/feature-detects/websockets/binary.js
try { try {
if (bt && if (bt && ('binaryType' in (new WebSocket("ws://localhost:17523")))) {
('binaryType' in WebSocket.prototype ||
!!(new WebSocket(ws_schema + '://.').binaryType))) {
Util.Info("Detected binaryType support in WebSockets"); Util.Info("Detected binaryType support in WebSockets");
wsbt = true; wsbt = true;
} }
...@@ -328,8 +325,7 @@ function init(protocols, ws_schema) { ...@@ -328,8 +325,7 @@ function init(protocols, ws_schema) {
} }
function open(uri, protocols) { function open(uri, protocols) {
var ws_schema = uri.match(/^([a-z]+):\/\//)[1]; protocols = init(protocols);
protocols = init(protocols, ws_schema);
if (test_mode) { if (test_mode) {
websocket = {}; websocket = {};
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment