| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>ws test</title>
- <script src="data.js"></script>
- </head>
-
- <body>
- <script>
-
- function on_ws_msg(bin){
- var j = BIN.hdr.b2j(bin);
-
- console.log(j);
- var b = BIN.hdr.j2b(j);
-
- console.log(b);
- ws.send(b);
-
- }
- function ws_hdr(){
- var proto = window.location.protocol,ws;
- if (proto == 'https:'){
- ws = 'wss://';
- }else{
- ws = 'ws://';
- }
- return ws;
- }
- ws = new WS("ws://localhost:8888/websocket",on_ws_msg);
-
-
-
- </script>
- </body>
- </html>
|