You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
513 B

2 years ago
2 years ago
2 years ago
2 years ago
  1. const express = require('express');
  2. const app = express();
  3. const http = require("http");
  4. const server = http.createServer(app);
  5. const { Server } = require("socket.io");
  6. const io = new Server(server);
  7. app.get('/', (req, res) => {
  8. res.sendFile(__dirname + '/index.html');
  9. });
  10. io.on('connection', (socket) => {
  11. console.log('a new user connected');
  12. socket.on('disconnect', () => {
  13. console.log('user disconnected');
  14. });
  15. });
  16. server.listen(3030, () => {
  17. console.log('listening on beaglebone.local:3030');
  18. });