Keep Alive Implementation

edited July 2010 in Photon Server
I use the Photon-Server-SDK_v2-0-0-RC4, but I found that the keep alive doesn't exist.
Namely the photon application needs to know when a client disconnects from server due to:
the browser is closed, the computer is off, etc.. I implement the sending of messages per second,
but we had problems. I need to know if the latest version v2-0-4 implements something like that.

Comments

  • BorisBoris ✭✭
    Photon sends small "ping" packages in the background to keep alive the connection.
    If these packages are not acknowledged the client is disconnected and the business logic is notified.
    This has always been a feature of Photon.
    New is that you can configure the disconnect timeout with the MinimumTimeout and MaximumTimeout setting in the PhotonSocketServer.xml file.
  • Thanks. I only need some guide about the configuration of the ENet section.
  • BorisBoris ✭✭
    Just to make sure: This was about Enet only.
    TCP manages disconnect timeouts internally.
  • newton3 wrote:
    Thanks. I only need some guide about the configuration of the ENet section.
    Not sure if you found it already. It's in doc/photon-configuration.pdf.

    The timeout we use is not a hard time limit. It will depend on the connection quality before packets start missing.
    Don't set the value too low, cause this could provoke unnecessary timeouts. Experiment with the times.
  • Ok, But I think so that the Enet protocol runs over UDP, my clients are flash clients that run over TCP, in tihs case applies the same configuration of the MinimumTimeout and MaximumTimeout?

    I need help to understand over this aspect.

    Thanks.
  • You are right. In that case, we (have to) use TCP. Flash does not support UDP socket use.
    The timeout of this is handled completely by the TCP layer and I think there are not a lot of settings for this.
  • I can configure the InactivityTimeout to 5000 ms on the TCPListener section and to make that the clients sends "keep alive" messages to server every 1000 ms, so if the server don't gets the "keep alive" messages in 5000 ms, the Photon Server application will generate an disconnect notification?

    On the other hand I can activate and configure the TCP Keep-Alive on the Server System (http://msdn.microsoft.com/en-us/library/ms819735.aspx). This will have effect in the Photon Server?
  • You are right:
    The InactivityTimeout will disconnect a client if it did not send any data within the interval. The client has to make sure it's sending anything in shorter intervals than the timeout. So far, this is a manual thing you have to take care of.
    This disconnect operates on a different level than a TCP timeout.


    I failed to reproduce your scenario with the current v2.0.4 release of Photon. Admittedly, I used Silverlight and the DotNet realtime demos to check. Whenever one of the two player-clients gets closed (closing the browser window), the other removes that player immediately.

    Maybe this is a Flash-only thing. I will have to test.
Sign In or Register to comment.