Open dziad-yge opened 5 years ago
For quick detection of connection loss, both peers (the WAMP client and the WAMP router) need to do heartbeating (WebSocket ping/pong). Anything using TCP over WAN needs to do sth like that for quick detection.
For the ApplicationRunner when using Twisted we do have client-initiated heartbeating: https://github.com/crossbario/autobahn-python/blob/master/autobahn/twisted/wamp.py#L289
For Component: @meejah not sure ...
i have this same issue, the router i'm using already uses WebSocket ping/pong and correctly detects the client no longer being connected
The client however can take up to a few minutes to detect that it's wireless network is gone and it disconnected, this makes a short loss of network cause long periods of not being connected, a big problem for our system where all devices are wireless
having a option to set the timeout on a components transport config in a similar way to how the application runner does it seems like a good solution to me.
Still an issue, any progress or workaround?
it's been about a year now
Hi,
How can I make autobahn.twisted.component.Component notice lost of connection with router quickly? Do I have any influence on time it takes?
I've tried couple of ideas but they seem not to work.
My case: I have crossbar.io router with ping-pong specified. I have clients communicating with router using autobahn in Python 2.7 (on Ubuntu and on Mint). I've created an autobahn.twisted.component.Component object and also keep access to Session object I've received at 'on component join'. If I lose connection to router, error 'wamp.close.transport_lost' is raised, then session leaves and component tries to reconnect. This is the scenario I like.
However when I lose connection (by unplugging the internet cable), it can take a lot of time before autobahn fires 'wamp.close.transport_lost. For clients running on Ubuntu it's around 10 sec. But for clients on Mint it's around 20 minutes. I wish I could have a ping-pong with router, but I haven't found such an option for Component transport.
Then I got another idea. I've decided to use simple python socket to check if I can connect to the port the crossbar.io listens on. If no, I know I have no connection with router for whatever reason. If yes, I need to verify if my session is still attached to the router. If it is not attached, I would use session.disconnect() and then session.leave(). After that 'wamp.close.transport_lost' is raised and Component starts reconnecting by himself.
How can I verify if my session is attached to the router?
Could you give me some advice, how to achieve my goal?
Thanks for help Dziad-yge