Initial commit
This commit is contained in:
commit
d1c74c861e
57 changed files with 4568 additions and 0 deletions
15
src/websocket/websocketServer.ts
Normal file
15
src/websocket/websocketServer.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { WebSocketServer } from 'ws';
|
||||
import { handleConnection } from './connectionManager';
|
||||
import http from 'http';
|
||||
|
||||
export const initServer = (
|
||||
server: http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>,
|
||||
) => {
|
||||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', (ws) => {
|
||||
handleConnection(ws);
|
||||
});
|
||||
|
||||
console.log(`WebSocket server started on port ${process.env.PORT}`);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue