summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi Ichikawa <gimite@gmail.com>2010-07-03 20:59:18 +0900
committerHiroshi Ichikawa <gimite@gmail.com>2010-07-03 20:59:18 +0900
commit1af4242cdf5202b86a47b86d9abbafd4e5cbe049 (patch)
treebc7a80b2264239867e3b64c11e368d36fdc21512
parent4cf54d0fa482f782e117fe844e4c28e768c65f8a (diff)
downloadweb-socket-js-1af4242cdf5202b86a47b86d9abbafd4e5cbe049.tar.gz
Adding more detailed troubleshooting. Showing error on file:///... URL.
-rw-r--r--README.txt27
-rwxr-xr-xweb_socket.js6
2 files changed, 27 insertions, 6 deletions
diff --git a/README.txt b/README.txt
index 7968706..3e3c767 100644
--- a/README.txt
+++ b/README.txt
@@ -15,14 +15,29 @@ Assuming you have Web server (e.g. Apache) running at http://example.com/ .
#1: First argument of echo_server.rb means that it accepts Web Socket connection from HTML pages in example.com.
-* How to debug
+* Troubleshooting
-If sample.html doesn't work, check these:
+If it doesn't work, try these:
-- It doesn't work when you open sample.html as local file i.e. file:///.../sample.html. Open it via Web server.
-- Make sure port 10081 is not blocked by your server/client's firewall.
-- Use Developer Tools (Chrome/Safari) or Firebug (Firefox) to see if console.log outputs any errors.
-- Install debugger version of Flash Player available here to see Flash errors:
+1. Try Chrome and Firefox 3.x.
+- It doesn't work on Chrome:
+-- It's likely an issue of your code or the server. Debug your code as usual e.g. using console.log.
+- It works on Chrome but it doesn't work on Firefox:
+-- It's likely an issue of web-socket-js specific configuration (e.g. 3 and 4 below).
+- It works on both Chrome and Firefox, but it doesn't work on your browser:
+-- Check "Supported environment" section below. Your browser may not be supported by web-socket-js.
+
+2. Use Developer Tools (Chrome/Safari) or Firebug (Firefox) to see if console.log outputs any errors.
+
+3. Make sure you do NOT open your HTML page as local file e.g. file:///.../sample.html. web-socket-js doesn't work on local file. Open it via Web server e.g. http:///.../sample.html.
+
+4. If you are NOT using web-socket-ruby as your WebSocket server, you need to place Flash socket policy file on your server. See "Flash socket policy file" section below for details.
+
+5. Check if sample.html bundled with web-socket-js works.
+
+6. Make sure the port used for WebSocket (10081 in example above) is not blocked by your server/client's firewall.
+
+7. Install debugger version of Flash Player available here to see Flash errors:
http://www.adobe.com/support/flashplayer/downloads.html
diff --git a/web_socket.js b/web_socket.js
index 422d25a..47526be 100755
--- a/web_socket.js
+++ b/web_socket.js
@@ -26,6 +26,12 @@
console.error("Flash Player is not installed.");
return;
}
+ console.log(location.protocol);
+ if (location.protocol == "file:") {
+ console.error(
+ "web-socket-js doesn't work in file:///... URL (without special configuration). " +
+ "Open the page via Web server i.e. http://...");
+ }
WebSocket = function(url, protocol, proxyHost, proxyPort, headers) {
var self = this;