Initial commit

This commit is contained in:
ItzCrazyKns 2024-04-09 16:21:05 +05:30
commit d1c74c861e
No known key found for this signature in database
GPG key ID: 8162927C7CCE3065
57 changed files with 4568 additions and 0 deletions

View 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}`);
};