WIP: Testing WS
This commit is contained in:
20
server/index.js
Normal file
20
server/index.js
Normal 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}`);
|
||||
});
|
Reference in New Issue
Block a user