1 const express = require('express');
3 const http = require('http');
4 const server = http.createServer(app);
5 const { Server } = require("socket.io");
6 const io = new Server(server);
9 app.get('/index.html', (req, res) => {
10 res.sendFile(__dirname + '/index.html');
13 io.on('connection', (socket) => {
14 socket.on('comment', (msg) => {
15 io.emit('comment', msg);
19 server.listen(port, () => {
20 console.log(`listening on *:${port}`);