Commit bee36506 authored by Joel Martin's avatar Joel Martin

Fix forcing of web-socket-js even when native available.

parent cb3ad1b5
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
(function() { (function() {
if (window.WebSocket) return; if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) return;
var console = window.console; var console = window.console;
if (!console || !console.log || !console.error) { if (!console || !console.log || !console.error) {
......
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
// Load Flash WebSocket emulator if needed // Load Flash WebSocket emulator if needed
// To force WebSocket emulator even when native WebSocket available
window.WEB_SOCKET_FORCE_FLASH = true;
// To enable WebSocket emulator debug:
window.WEB_SOCKET_DEBUG=1;
if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) { if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
Websock_native = true; Websock_native = true;
} else if (window.MozWebSocket && !window.WEB_SOCKET_FORCE_FLASH) { } else if (window.MozWebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
...@@ -28,9 +33,6 @@ if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) { ...@@ -28,9 +33,6 @@ if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
} else { } else {
/* no builtin WebSocket so load web_socket.js */ /* no builtin WebSocket so load web_socket.js */
// To enable debug:
// window.WEB_SOCKET_DEBUG=1;
Websock_native = false; Websock_native = false;
(function () { (function () {
function get_INCLUDE_URI() { function get_INCLUDE_URI() {
...@@ -280,6 +282,8 @@ function open(uri) { ...@@ -280,6 +282,8 @@ function open(uri) {
Util.Debug(">> WebSock.onopen"); Util.Debug(">> WebSock.onopen");
if (websocket.protocol) { if (websocket.protocol) {
Util.Info("Server chose sub-protocol: " + websocket.protocol); Util.Info("Server chose sub-protocol: " + websocket.protocol);
} else {
Util.Error("Server select no sub-protocol!: " + websocket.protocol);
} }
eventHandlers.open(); eventHandlers.open();
Util.Debug("<< WebSock.onopen"); Util.Debug("<< WebSock.onopen");
......
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