Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionTimeout on the server must be optional #10

Open
loothood opened this issue Nov 30, 2022 · 1 comment
Open

ConnectionTimeout on the server must be optional #10

loothood opened this issue Nov 30, 2022 · 1 comment

Comments

@loothood
Copy link

loothood commented Nov 30, 2022

Hi,
Thank you for the project. Very helpful

On the server side of your project there is a code:

packets.listen((packet) {
      final connection = _findExistingConnection(packet.address) ??
          Connection(clientSalt: 0, serverSalt: 0, address: packet.address);
      if (_connectionTimers[connection] != null) {
        _connectionTimeout(connection);
      }
    });

I'm trying to use the server in broadcast mode and I faced an issue: if my client does not send any to the server for 5 sec, the server initials the client disconnection.

I have a step-based game. And the client has 30 secs to think before the moving. I don't send any action to the server during that time. All the game states got from the server in broadcast mode. But my client disconnects all the time if there are no messages from the client for 5 secs. Could you make _connectionTimeout an optional parameter, please?

@wolfenrain
Copy link
Owner

I do agree that the timeout should be optional, but for game netcode you should keep the connection alive by passing a KeepAlive packet both ways.

This allows you to calculate pings on both sides and even in a step-based games this has some merit as you want to know earlier than later if a client is connected or not.

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

No branches or pull requests

2 participants