UNPKG

638 BHTMLView Raw
1<html>
2 <head>
3 <title id="ewd-qoper8 Demo"></title>
4 </head>
5 <body>
6
7 <script src="/socket.io/socket.io.js"></script>
8 <script>
9 var socket = io.connect();
10 socket.on('my-response', function (data) {
11 console.log('ewd-qoper8 message received: ' + JSON.stringify(data, null, 2));
12 });
13
14 function sendMessage() {
15 var message = {
16 type: 'testSocketRequest',
17 hello: 'world'
18 };
19 socket.emit('my-request', message);
20 }
21 </script>
22
23 <div>
24 <button onClick='sendMessage()'>Click me</button>
25 </div>
26
27 </body>
28</html>
\No newline at end of file