We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a618caa commit 3dca835Copy full SHA for 3dca835
static/websocket.js
@@ -1,4 +1,6 @@
1
var websocket;
2
+// This url can be used for testing. It echoes anything that you send to it.
3
+// var websocketUrl = "ws://echo.websocket.org";
4
var websocketUrl = "ws://localhost:9000/echo"; // cd_websocket.c demands this url.
5
6
function init() {
@@ -21,6 +23,17 @@ function onMessage(event) {
21
23
progress = event.data;
22
24
25
console.log("WebSocket received message: " + progress);
26
+ if ($.isNumeric(progress) == false)
27
+ {
28
+ console.log("Received non-numeric data!");
29
+ return;
30
+ }
31
+ if (progress < 0 || progress > 100)
32
33
+ console.log("Progress out of range!");
34
35
36
+
37
updateProgressBar(progress);
38
}
39
0 commit comments