|
@@ -262,7 +262,7 @@ function on(evt, handler) {
|
|
|
eventHandlers[evt] = handler;
|
|
|
}
|
|
|
|
|
|
-function init(protocols) {
|
|
|
+function init(protocols, ws_schema) {
|
|
|
rQ = [];
|
|
|
rQi = 0;
|
|
|
sQ = [];
|
|
@@ -278,11 +278,14 @@ function init(protocols) {
|
|
|
bt = true;
|
|
|
}
|
|
|
|
|
|
- // Check for full binary type support in WebSockets
|
|
|
- // TODO: this sucks, the property should exist on the prototype
|
|
|
- // but it does not.
|
|
|
+ // Check for full binary type support in WebSocket
|
|
|
+ // Inspired by:
|
|
|
+ // https://github.com/Modernizr/Modernizr/issues/370
|
|
|
+ // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/websockets/binary.js
|
|
|
try {
|
|
|
- if (bt && ('binaryType' in (new WebSocket("wss://localhost:17523")))) {
|
|
|
+ if (bt &&
|
|
|
+ ('binaryType' in WebSocket.prototype ||
|
|
|
+ !!(new WebSocket(ws_schema + '://.').binaryType))) {
|
|
|
Util.Info("Detected binaryType support in WebSockets");
|
|
|
wsbt = true;
|
|
|
}
|
|
@@ -325,7 +328,8 @@ function init(protocols) {
|
|
|
}
|
|
|
|
|
|
function open(uri, protocols) {
|
|
|
- protocols = init(protocols);
|
|
|
+ var ws_schema = uri.match(/^([a-z]+):\/\//)[1];
|
|
|
+ protocols = init(protocols, ws_schema);
|
|
|
|
|
|
if (test_mode) {
|
|
|
websocket = {};
|