WIP: Testing WS

This commit is contained in:
Andras Bacsai
2022-05-11 16:15:34 +02:00
parent 3435f92fcb
commit 16b7c1708b
8 changed files with 783 additions and 13 deletions

20
server/index.js Normal file
View File

@@ -0,0 +1,20 @@
import express from 'express';
import { createServer } from 'http';
import { Server } from 'socket.io';
import { handler } from '../build/handler.js';
const app = express();
const server = createServer(app);
const io = new Server(server);
io.on('connection', (socket) => {
socket.emit('eventFromServer', 'Hello, World 👋');
});
app.use(handler);
server.listen(port, () => {
console.log(`Listening on port ${port}`);
});