summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2012-06-08 10:42:26 -0500
committerJoel Martin <github@martintribe.org>2012-06-08 10:42:26 -0500
commitbee36506e1b6d70109e540697ec17c6da75000f7 (patch)
tree9cb483246755ed51f57a361cb204f40e5ab7b765
parentcb3ad1b5b5d7dadbee7bb1f4ec5b82e302d1d493 (diff)
downloadnovnc-bee36506e1b6d70109e540697ec17c6da75000f7.tar.gz
Fix forcing of web-socket-js even when native available.
-rw-r--r--include/web-socket-js/web_socket.js2
-rw-r--r--include/websock.js10
2 files changed, 8 insertions, 4 deletions
diff --git a/include/web-socket-js/web_socket.js b/include/web-socket-js/web_socket.js
index ec2a8b7..a133013 100644
--- a/include/web-socket-js/web_socket.js
+++ b/include/web-socket-js/web_socket.js
@@ -5,7 +5,7 @@
(function() {
- if (window.WebSocket) return;
+ if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) return;
var console = window.console;
if (!console || !console.log || !console.error) {
diff --git a/include/websock.js b/include/websock.js
index 33350df..69b58f4 100644
--- a/include/websock.js
+++ b/include/websock.js
@@ -20,6 +20,11 @@
// 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) {
Websock_native = true;
} else if (window.MozWebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
@@ -28,9 +33,6 @@ if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
} else {
/* no builtin WebSocket so load web_socket.js */
- // To enable debug:
- // window.WEB_SOCKET_DEBUG=1;
-
Websock_native = false;
(function () {
function get_INCLUDE_URI() {
@@ -280,6 +282,8 @@ function open(uri) {
Util.Debug(">> WebSock.onopen");
if (websocket.protocol) {
Util.Info("Server chose sub-protocol: " + websocket.protocol);
+ } else {
+ Util.Error("Server select no sub-protocol!: " + websocket.protocol);
}
eventHandlers.open();
Util.Debug("<< WebSock.onopen");