setDisconnectTimeout is not working

Hello, I am using client version: photon-androidndk-sdk_v4-1-10-2, server version: Photon-OnPremise-Server-SDK_v4-0-29-11263. I found that the setDisconnectTimeout function is not working. When I turned off wifi, I got Status Code 1025 immediately. That means "the PhotonPeer just disconnected." My initial Code is like:

_peer = new PhotonPeer(*this, ConnectionProtocol::TCP);
_peer->setDebugOutputLevel(DebugLevel::INFO);
_peer->setDisconnectTimeout(15000);

Comments

  • Hi @ExitVip.

    This is intended behavior.

    When you turn off WiFi on you device, then the OS knows that the connection is lost and the socket can report an error to the Photon Client, which can inform you about the connection loss.
    The disconnect timeout comes into play when a disconnect can not be detected immediately, because the cause of it is not located on the device itself. Hence a better test scenario would be to turn off your WiFi router, while your device is connected to it.
    The typical scenario however is that you have a connection, but the connection quality is low. Maybe you are on a mobile network and have very bad coverage that is varying wildly whenever the position of your device changes even slightly.
    Photon will send ping messages in intervals that you can adjust through setTimePingInterval(). When it does not receive a response that the remote side received a certain ping message within the timeout time, then it will consider the connection lost.
  • Hi @Kaiserludi admin.
    Thank you for your replay. I got it.
Sign In or Register to comment.