Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

State not changed to disconnected when connection is lost #100

Open
borjaj opened this issue Jan 11, 2017 · 1 comment
Open

State not changed to disconnected when connection is lost #100

borjaj opened this issue Jan 11, 2017 · 1 comment

Comments

@borjaj
Copy link

borjaj commented Jan 11, 2017

Hi, I need to execute a particular method when the connection to the server is lost.
I have subscribed to status events, they work ok from disconected-connecting-connected state but nothing happens when I shut down internet connection..

client.statusChanged().subscribe(t1 -> {
LOGGER.info("WAMP Session status changed to " + t1);

        if(t1 instanceof  WampClient.DisconnectedState){
            LOGGER.info("DISC");
        }

...

Thanks in advance ;)

@Matthias247
Copy link
Owner

Most likely the usual issue of operating systems not reporting a TCP connection state reliably. That's e.g. what happens when you just plug a network cable while nothing is transferred: There's no FIN received, so OS thinks connection is still alive. And as no sends happen the TCP stack also does not see these are failing.

Remedies for that are either some heartbeat messages on transport layer (websocket pings would work, but are not sent by jawampa). Or polling some arbitrary method on application layer just for regular checking if the connection still works. If an error is discovered then the Disconnected event should be emitted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants