diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-29 19:13:44 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-29 19:13:44 (GMT) |
commit | 6467923f8caaa02829fc53666b32df594da3ea68 (patch) | |
tree | bb3cdcc4f93dfee929b2c991e8bcbc1bfc1ed6e9 /test/socket.html | |
parent | 4911fe3fd94019fcca730710e0b411e8e5a66847 (diff) |
websocket handler new/run works now (needs testing!)
Diffstat (limited to 'test/socket.html')
-rw-r--r-- | test/socket.html | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/test/socket.html b/test/socket.html index 9ee91b6..06fce06 100644 --- a/test/socket.html +++ b/test/socket.html @@ -1,6 +1,8 @@ +<!DOCTYPE HTML> <html> <head> <title>rhimportd - Testclient</title> + <meta charset="utf-8"> <style type="text/css"> body { background-color: #555; @@ -15,20 +17,29 @@ </style> <script src="jquery.min.js"></script> <script type="text/javascript"> - function Test() { - this.sock = new WebSocket("ws://localhost:4080/trusted/socket"); + function Session(req) { + this.req = req + this.sock = new WebSocket("ws://localhost:4080/public/socket"); this.sock.onmessage = function (event) { $('#rawmsg').text(event.data); } - this.update = function() { - this.sock.send(JSON.stringify({ COMMAND: "new" })); + this.sock_onopen = function() { + this.req.COMMAND = "new"; + this.req.TIMEOUT = 200; + this.sock.send(JSON.stringify(this.req)); } + this.sock.onopen = this.sock_onopen.bind(this); } + var s; + function init() { - test = new Test(); - setInterval(test.update.bind(test), 1000); - // test.update(); + req = { LOGIN_NAME: "heslinki", + PASSWORD: "12423", + SHOW_ID: 10002, + CLEAR_SHOW_CARTS: true, + SOURCE_URI: "fake://100" }; + s = new Session(req); } </script> </head> |