aboutsummaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorcbdev <cb@cbcdn.com>2019-05-18 19:20:21 +0200
committercbdev <cb@cbcdn.com>2019-05-18 19:20:21 +0200
commit49ce320f17729a0cf0df0bd1322639ddf55e2402 (patch)
treeab378ab9e21ff1d514e5264a219a39b6d72c75fc /index.html
parentff94e4518d417d88f2fabdfca7025e68ce21849b (diff)
downloadwebsocksy-49ce320f17729a0cf0df0bd1322639ddf55e2402.tar.gz
websocksy-49ce320f17729a0cf0df0bd1322639ddf55e2402.tar.bz2
websocksy-49ce320f17729a0cf0df0bd1322639ddf55e2402.zip
Basic websocket framing
Diffstat (limited to 'index.html')
-rw-r--r--index.html13
1 files changed, 10 insertions, 3 deletions
diff --git a/index.html b/index.html
index 8a9ae9c..845744b 100644
--- a/index.html
+++ b/index.html
@@ -4,13 +4,20 @@
var webSocket = null;
function openSocket(){
- webSocket = new WebSocket("ws://localhost:8001/foo/bar");
- webSocket.onclose = openSocket;
+ setTimeout(function(){
+ webSocket = new WebSocket("ws://localhost:8001/foo/bar");
+ webSocket.onclose = openSocket;
+ webSocket.onmessage = function(event){
+ console.log(event.data);
+ };
+ }, 1000);
}
function init(){
openSocket();
- setInterval(function(){webSocket.send("foo");}, 1000);
+ setInterval(function(){
+ webSocket.send("foo");
+ }, 1000);
}
</script>
</head>