Browse Source

Merge pull request #35 from Type1J/master

Fixing to be compatable with newer WebSocket implementation.
JoshEngebretson 10 years ago
parent
commit
524289909c
1 changed files with 3 additions and 3 deletions
  1. 3 3
      WebSocketExample/Resources/Scripts/main.js

+ 3 - 3
WebSocketExample/Resources/Scripts/main.js

@@ -23,11 +23,11 @@ ws.subscribeToEvent("open", function() {
 // Listen for messages
 ws.subscribeToEvent("message", function (event) {
 
-    console.log("WebSocket Message: " + event.data);
+    console.log("WebSocket Message: " + event.message.readString());
 
     // We would normally keep the WebSocket open for a long time, but
     // here we are demonstrating how to use ws.openAgain() below, so
-    // we'll close the WebSocket after 5 seconds of getting the message.
+    // we'll close the WebSocket after a few seconds of getting the message.
     setTimeout(function() {
         ws.close();
     }, 2000);
@@ -42,7 +42,7 @@ ws.subscribeToEvent("close", function() {
     if (num_times_to_connect) {
         num_times_to_connect--;
 
-        // Open the websocket again after 5 more seconds.
+        // Open the websocket again after a few more seconds.
         setTimeout(function() {
             ws.openAgain();
         }, 2000);