|
|
@@ -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);
|