in websocket-server/src/sessionManager.ts [38:48]
export function handleFrontendConnection(ws: WebSocket) {
cleanupConnection(session.frontendConn);
session.frontendConn = ws;
ws.on("message", handleFrontendMessage);
ws.on("close", () => {
cleanupConnection(session.frontendConn);
session.frontendConn = undefined;
if (!session.twilioConn && !session.modelConn) session = {};
});
}