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

This commit is contained in:
Joel Martin 2012-06-08 10:42:26 -05:00
parent cb3ad1b5b5
commit bee36506e1
2 changed files with 8 additions and 4 deletions

View File

@ -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) {

View File

@ -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");