Commit e1116c9e285d1d5156ae906ca5573a5ca9c5ac2e

Authored by Andrew Buss
1 parent e81f3fe030

add deck listener

Showing 1 changed file with 17 additions and 2 deletions Side-by-side Diff

ws_debug.html View file @ e1116c9
... ... @@ -18,8 +18,23 @@
18 18 new_uri = "ws:";
19 19 }
20 20 new_uri += "//" + loc.host;
21   - new_uri += "/ws/feed/496?subscribe-broadcast";
22   - var ws = new WebSocket(new_uri);
  21 + var ws = new WebSocket(new_uri + '/ws/deck/496?subscribe-user');
  22 + ws.onopen = function () {
  23 + console.log("websocket connected");
  24 + };
  25 + ws.onmessage = function (e) {
  26 + $('ul').append('<li>' + e.data + '</li>');
  27 + };
  28 + ws.onerror = function (e) {
  29 + console.error(e);
  30 + };
  31 + ws.onclose = function (e) {
  32 + console.log("connection closed");
  33 + };
  34 + function send_message(msg) {1
  35 + ws.send(msg);
  36 + }
  37 + var ws = new WebSocket(new_uri + '/ws/feed/496?subscribe-broadcast');
23 38 ws.onopen = function () {
24 39 console.log("websocket connected");
25 40 };