From ff94e4518d417d88f2fabdfca7025e68ce21849b Mon Sep 17 00:00:00 2001 From: cbdev <cb@cbcdn.com> Date: Sat, 18 May 2019 13:12:46 +0200 Subject: Complete WS connection establishment --- index.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'index.html') diff --git a/index.html b/index.html index 233ee69..8a9ae9c 100644 --- a/index.html +++ b/index.html @@ -1,8 +1,16 @@ <html> <head> <script type="text/javascript"> + var webSocket = null; + + function openSocket(){ + webSocket = new WebSocket("ws://localhost:8001/foo/bar"); + webSocket.onclose = openSocket; + } + function init(){ - var webSocket = new WebSocket("ws://localhost:8001/foo/bar"); + openSocket(); + setInterval(function(){webSocket.send("foo");}, 1000); } </script> </head> -- cgit v1.2.3