Is there a way to check, that the broadcasted message was received by the client?

Hi!

While developing a turn-based single-player online card game, we’ve faced a regular issue for that kind of games: when our Typescript Runtime backend sends a message, it is not received by the client right away - obviously, there’s a network lag. However, backend starts a timer to the next round right away after broadcasting the message, so, sometimes, client still haven’t received our last message, but the timer on the backend has already ran out, and started the next round.

Basically, we would like to check if the broadcasted message has already been received, and start our timer only when it is received. Is this possible?

Well yes, you would need to do acknowledgement of that message for example:

  • Server broadcast message with opcode (1) TURN_START

  • Clients when they receive message with opcode (1) → send to server only message with opcode 2: (RECEIVED_TURN_START)

  • Obviously you do this through match state updates.

1 Like

Hey! Thanks. It is definitely a solution, however it can slow down the whole process by at least 2x - double the network lag. I was thinking, since the Nakama’s match runtime communication is based on Websockets, and subsequently, TCP - we could check from the lower level, without additional messages sent. Also, there’s a reliable param to the broadcastMessage function, which may lead us to the solution. I was thinking, maybe @sesposito could clear the question on that?

Hello @RickCastle2018

There’s no way to access the lower level TCP frames so your best option is to follow @Eatos suggestion, your game logic should wait for the clients to have acked the messages before starting the next turn (with a maximum threshold if it makes sense).

Best.

1 Like