summaryrefslogtreecommitdiff
path: root/web-static/socket.html
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-06-24 00:03:34 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-06-24 00:03:34 (GMT)
commit71de69ce36191fa255fd38e9f38bd3132aff72a4 (patch)
tree53ff9883398401b3620ed5a1b95af87e7d8052f8 /web-static/socket.html
parent65a9d2c8d9eb7d4880ee1527de54fa212035af10 (diff)
receiving binary messages works
Diffstat (limited to 'web-static/socket.html')
-rw-r--r--web-static/socket.html17
1 files changed, 16 insertions, 1 deletions
diff --git a/web-static/socket.html b/web-static/socket.html
index fda00e9..3737c5f 100644
--- a/web-static/socket.html
+++ b/web-static/socket.html
@@ -74,6 +74,10 @@
}
this.sock.onopen = this.sock_onopen.bind(this);
+ this.sendbinmsg = function(data) {
+ this.sock.send(data);
+ }
+
this.cancel = function() {
this.sock.send(JSON.stringify({COMMAND: "cancel"}));
}
@@ -100,6 +104,14 @@
s = new Session(req);
}
+ function sendbinmsg() {
+ var byteArray = new Uint8Array(100);
+ for (var x = 0; x < byteArray.length; x++){
+ byteArray[x] = x
+ }
+ s.sendbinmsg(new Blob([byteArray], {type: "application/octet-stream"}));
+ }
+
function cancel() {
s.cancel();
}
@@ -112,6 +124,7 @@
function buttonsIdle() {
$('#buttonrun').removeAttr('disabled')
$('#buttonreconnect').removeAttr('disabled')
+ $('#buttonbinmsg').attr('disabled','disabled')
$('#buttondetach').attr('disabled','disabled')
$('#buttoncancel').attr('disabled','disabled')
}
@@ -119,6 +132,7 @@
function buttonsRunning() {
$('#buttonrun').attr('disabled','disabled')
$('#buttonreconnect').attr('disabled','disabled')
+ $('#buttonbinmsg').removeAttr('disabled')
$('#buttondetach').removeAttr('disabled')
$('#buttoncancel').removeAttr('disabled')
}
@@ -127,7 +141,7 @@
$('#sessionid').val("");
buttonsIdle();
}
-</script>
+ </script>
</head>
<body onload="init()">
@@ -149,6 +163,7 @@
<input id="source" type="text" size="30" value="fake://10000">
<input id="refid" type="text" size="15" value="test-reference-id">
<button id="buttonrun" onclick="run()">start</button>
+ <button id="buttonbinmsg" onclick="sendbinmsg()">send binary message</button>
<button id="buttondetach" onclick="detach()">detach</button>
<input id="sessionid" type="text" size="45">
<button id="buttonreconnect" onclick="reconnect()">reconnect</button>