import { Socket } from "socket.io" ; import { logger } from "../log" ; import { HandshakeListenerDependencies , HandshakeRequest } from "./types" ; /**
 * Attaches to the socket server and raises incoming handshake requests.
 */ export const handshakeListener = ( deps , onReceive ) => { const { io } = deps ; logger . info ( "Listening for successful handshakes - inner B" ) ; io . on ( "connection" , socket => { logger . info ( `[socket ${ socket . id }] New connection received` ) ; socket . on ( "authenticate" , ( request ) => { logger . info ( `[socket ${ socket . id }] Handshake request received` ) ; onReceive ( socket , request ) ; } ) ; } ) ; } ;