]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Make websocket demo work on firefox 6 beta
authorBen Darnell <ben@bendarnell.com>
Sun, 17 Jul 2011 22:01:07 +0000 (15:01 -0700)
committerBen Darnell <ben@bendarnell.com>
Sun, 17 Jul 2011 22:01:07 +0000 (15:01 -0700)
demos/websocket/static/chat.js

index 236cb0d41b0f4e48cbee8532f6678d0b6fdf2a77..818bc031aa064a7746f52233ea558a5127f4618a 100644 (file)
@@ -50,7 +50,11 @@ var updater = {
     socket: null,
 
     start: function() {
-       updater.socket = new WebSocket("ws://localhost:8888/chatsocket");
+        if ("WebSocket" in window) {
+           updater.socket = new WebSocket("ws://localhost:8888/chatsocket");
+        } else {
+            updater.socket = new MozWebSocket("ws://localhost:8888/chatsocket");
+        }
        updater.socket.onmessage = function(event) {
            updater.showMessage(JSON.parse(event.data));
        }