Suppose I have a scenario in which I want to run an authoritative speed test of the player’s connection on my Nakama backend. What I have in mind is to send a timestamped amount of bytes (1024 for example) in one BroadcastMessage and send a timestamped ack from the client to show it received the payload. Based on the time difference, I should be able to determine the download speed of the client. I can do the opposite to determine the upload speed. In this scenario, I do not need to be surgically accurate, just a decent average would suffice. Does this sound like a good approach to solve the problem or not?
@Mahdad-Baghani Your approach would work. You’ll need to use a before hook on the socket message so you can inspect it and do the time calculation but otherwise that looks good.
If you use the authoritative multiplayer engine then it also tags each socket message received with a “receive timestamp” which is the earliest point where the socket message got consumed from the socket buffer. The time difference will be very small though; it’s just a little more accurate but only relevant if you’re on the authoritative engine.
1 Like