oatpp / oatpp-websocket

oatpp-websocket submodule.

Home Page:https://oatpp.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Closing lost connection

mgandler opened this issue · comments

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

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

Hello @lganzzzo,

thank you for the quick response. I totally missed this function in the example.

BR
Martin