This commit is contained in:
karishmas6
2024-06-01 00:23:12 +05:30
parent ea7a3ea2c6
commit ba62599fb9

View File

@@ -0,0 +1,16 @@
import {Namespace, Socket} from 'socket.io';
import logger from "../logger";
export const createSocketConnection = (
io: Namespace,
callback: (socket: Socket) => void,
) => {
const onConnection = async (socket: Socket) => {
logger.log('info',"Client connected " + socket.id);
socket.on('disconnect', () => logger.log('info', "Client disconnected " + socket.id));
callback(socket);
}
io.on('connection', onConnection);
};