123456789101112131415161718192021222324252627282930313233343536373839 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Title</title>
- </head>
- <body>
- <div>
- <ul id="container">
- </ul>
- <input type="text" id="txtInput"/>
- <input type="button" value="发言" onclick="send()">
- <a target="_blank" href="http://localhost:8899/push/msg?msg=hello from push api">使用API推送消息</a>
- </div>
- </body>
- <script src="https://cdn.jsdelivr.net/npm/sockjs-client@1/dist/sockjs.min.js"></script>
- <script>
- var sock = new SockJS('ws://ws.anquanzhuli.com/ws?encoding=text&cId=1&gId=641&path=riskPointCount-back&from=aqpt.anquanzhuli.com');
- sock.onopen = function () {
- console.log('open');
- sock.send('test');
- };
- sock.onmessage = function (e) {
- console.log('message', e.data);
- sock.close();
- };
- sock.onclose = function () {
- console.log('close');
- };
- </script>
- </html>
|