123456789101112131415161718192021222324252627282930313233343536373839 |
- <!DOCTYPE html>
- <!-- saved from url=(0025)http://192.168.1.20:5000/ -->
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Static File Index.HTML</title>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js"></script>
- </head>
- <body>
- <div id="formContainer"></div>
- <input type="text" id="nickId" />
- <input type="text" id="msgId" />
- <button id="sendId">Send msg</button>
- <div class="chat" id="chatId">sdfasfasfvasafvasfabvfasdfbasbfas</div>
- <script>
- const socket = io("http://192.168.1.217:4000/");
- socket.on("msg", function (msg) {
- console.log(msg);
- chatId.innerHTML += '<br/>' + msg.nick + ': ' + msg.message;
- });
- sendId.onclick = () => {
- socket.emit("msg", {
- nick: nickId.value,
- message: msgId.value,
- });
- };
- </script>
- </body>
- </html>
|