Created
October 4, 2011 01:15
-
-
Save iuridiniz/1260694 to your computer and use it in GitHub Desktop.
WebSocket and MozWebSocket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -12,7 +12,8 @@ | |
element.appendChild(p); | |
} | |
- ws = new WebSocket("ws://localhost:8080/"); | |
+ var Socket = "MozWebSocket" in window ? MozWebSocket : WebSocket; | |
+ var ws = new Socket("ws://localhost:8080/"); | |
ws.onmessage = function(evt) { debug("Message: " + evt.data); }; | |
ws.onclose = function() { debug("socket closed"); }; | |
ws.onopen = function() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment