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

26 lines
558 B
JavaScript

10 months ago
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const { Server } = require("socket.io");
const io = new Server(server);
app.use(express.static('public'));
io.on('connection', (socket) => {
console.log('a user connected');
10 months ago
socket.on('picture', (line) => {
10 months ago
console.log(line);
10 months ago
socket.broadcast.emit("dingdong",line);
10 months ago
});
10 months ago
10 months ago
socket.on('disconnect', () => {
console.log('user disconnected');
});
});
server.listen(3000, () => {
console.log('listening on *:3000');
});