diff options
author | Wtritch <wtritchler@semanticresearch.com> | 2011-02-22 15:51:03 -0800 |
---|---|---|
committer | Wtritch <wtritchler@semanticresearch.com> | 2011-02-22 15:51:03 -0800 |
commit | 0591d5d3785f5f6e524f45f7f4280e2be8b66bb4 (patch) | |
tree | 63163c90bc952fca0b97293f29a4be0237295de1 | |
parent | eeedd74380ff3f3a9f9a71777e361537058701f1 (diff) | |
parent | efaf86f0a478b8ea74b9a90bfc314c79325f1115 (diff) | |
download | web-socket-js-0591d5d3785f5f6e524f45f7f4280e2be8b66bb4.tar.gz |
Pulled in upstream changes.
-rw-r--r-- | README.txt | 2 | ||||
-rw-r--r-- | WebSocketMainInsecure.zip | bin | 245413 -> 245413 bytes | |||
-rwxr-xr-x | flash-src/build.sh | 2 | ||||
-rwxr-xr-x | web_socket.js | 47 |
4 files changed, 32 insertions, 19 deletions
@@ -47,7 +47,7 @@ http://www.adobe.com/support/flashplayer/downloads.html It should work on: - Google Chrome 4 or later (just uses native implementation) -- Firefox 3.x, Internet Explorer 8 + Flash Player 9 or later +- Firefox 3.x, Internet Explorer 8 + Flash Player 10 or later It may or may not work on other browsers such as Safari, Opera or IE 6. Patch for these browsers are appreciated, but I will not work on fixing issues specific to these browsers by myself. diff --git a/WebSocketMainInsecure.zip b/WebSocketMainInsecure.zip Binary files differindex 99b6f66..3b77a82 100644 --- a/WebSocketMainInsecure.zip +++ b/WebSocketMainInsecure.zip diff --git a/flash-src/build.sh b/flash-src/build.sh index 9a4a732..32fa6b3 100755 --- a/flash-src/build.sh +++ b/flash-src/build.sh @@ -3,7 +3,7 @@ # You need Flex 4 SDK: # http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4 -mxmlc -static-link-runtime-shared-libraries -output=../WebSocketMain.swf WebSocketMain.as && +mxmlc -static-link-runtime-shared-libraries -target-player=10.0.0 -output=../WebSocketMain.swf WebSocketMain.as && mxmlc -static-link-runtime-shared-libraries -output=../WebSocketMainInsecure.swf WebSocketMainInsecure.as && cd .. && zip WebSocketMainInsecure.zip WebSocketMainInsecure.swf && diff --git a/web_socket.js b/web_socket.js index 3b39516..c0c54e2 100755 --- a/web_socket.js +++ b/web_socket.js @@ -5,23 +5,36 @@ (function() { - if (window.WebSocket) return; - - var console = window.console; - if (!console || !console.log || !console.error) { - console = {log: function(){ }, error: function(){ }}; - } - - if (!swfobject.hasFlashPlayerVersion("9.0.0")) { - console.error("Flash Player is not installed."); - return; - } - if (location.protocol == "file:") { - console.error( - "WARNING: web-socket-js doesn't work in file:///... URL " + - "unless you set Flash Security Settings properly. " + - "Open the page via Web server i.e. http://..."); - } + if (window.WebSocket) return; + + var console = window.console; + if (!console || !console.log || !console.error) { + console = {log: function(){ }, error: function(){ }}; + } + + if (!swfobject.hasFlashPlayerVersion("10.0.0")) { + console.error("Flash Player >= 10.0.0 is required."); + return; + } + if (location.protocol == "file:") { + console.error( + "WARNING: web-socket-js doesn't work in file:///... URL " + + "unless you set Flash Security Settings properly. " + + "Open the page via Web server i.e. http://..."); + } + + WebSocket = function(url, protocol, proxyHost, proxyPort, headers) { + var self = this; + self.readyState = WebSocket.CONNECTING; + self.bufferedAmount = 0; + // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc. + // Otherwise, when onopen fires immediately, onopen is called before it is set. + setTimeout(function() { + WebSocket.__addTask(function() { + self.__createFlash(url, protocol, proxyHost, proxyPort, headers); + }); + }, 0); + }; WebSocketController = function() { this._webSockets = {}; |