RevenantX / LiteNetLib

Lite reliable UDP library for Mono and .NET
https://revenantx.github.io/LiteNetLib/index.html
MIT License
3.07k stars 496 forks source link

Feature request: Reconnect client after server restart #214

Closed xmedeko closed 6 years ago

xmedeko commented 6 years ago

We have some kind of permanent rooms (permanent game) so we need to run one game server 24/7. Later, we may need to scale the server horizontally (and persist data by Redis.). I am testing LiteNetLib 0.7.7.2 for the scenario of the server crash and restart. (I expect similar scenario for the horizontal scaling, too.)

Current state: When the server restarts, it does not accepts any packets from the client, even when UnconnectedMessagesEnabled = true. The client waits until the DisconnectTimeout is reached and then is able to reconnect.

Required behaviour: I would like to reconnect the client immediately when the server is up, without waiting to the DisconnectTimeout. I.e. if the server receives any packet from not registered client (even the Ping packet), then I would like to send a messages to the client to reconnect. I think some kind of method INetEventListener.OnNetworkReceiveUnknown could do the jobs. Then I would be able to hook to send a custom unconnected message to it.

RevenantX commented 6 years ago

@xmedeko

even when UnconnectedMessagesEnabled = true

Server will accept that messages if you send them with SendUnconnectedMessage methods.

Required behaviour: I would like to reconnect the client immediately when the server is up, without waiting to the DisconnectTimeout

I think server can trigger some sort of disconnect message to "unknown" packets. I think i will add this feature to 0.8.x) This is good idea)

RevenantX commented 6 years ago

@xmedeko implemented