diff options
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> |