Closing lost connection
mgandler opened this issue · comments
mgandler commented
Hi,
I am trying to solve the following scenario using oatpp-websocket:
- Server is running and clients connects (permenant connection)
- Server sends ping every 30 seconds to check connection to each client
- Client disconnects without a proper closing handshake due to unplugged cable, power loss, forced ip switch, e.g.
- Server checks lost pings and need to remove connection
Is there a way to tell the AsyncWebSocket::Listener to close its connection and onBeforeDestroy_NonBlocking is called so I can remove the connection from the managment class.
Thanks
Martin
Leonid Stryzhevskyi commented
Hello @mgandler ,
An example of this is implemented in this example repo
particularly this line
You have to call ConnectionProvider::invalidate(<conntection>)
. Make sure to call exactly the same provider which issued that connection.
Regards,
Leonid