aboutsummaryrefslogtreecommitdiff
path: root/bench/socketio/server.js
blob: 21252f1929828fb9240c7fe34b7539c447241c7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
const http = require("http").createServer();

const io = require("socket.io")(http);
const port = process.env.PORT || 3000;
io.on("connection", socket => {
  socket.on("client to server event", msg => {
    io.emit("server to client event", msg);
  });
});

http.listen(port, () => {
  console.log(`Socket.IO server running at http://localhost:${port}/`);
});