You are not logged in.
I using Mormot in scenario similar to the chat demo 31. Clients send messages and Server should send it to all other clients.
So when server receives a message it iterates a list of connected clients and sends the message to all except client which sent it.
I don't use authentication, and so SessionClosed is not called, is there another way to detect when a client has disconnected ?
Offline
Usually, the disconnection frame opcode is supplied to the WebSockets event handler.
But if the client is not shutdown properly and doesn't send its "connection close" frame, then there is no such event... unless the server tries to send something to the client and there is a low-level socket error.
So you have to handle both cases.
Offline