Measuring Time Taken by Message To reach Client From Server

Options
Hi,
I have used photon server (.Net C#) code to build a turn-based game. backend is handled by photon server and i am using Photon Javascript SDK to connect the client to server. I need to find answers to the following questions:
1. Is there a way to measure how much time the message takes to reach the client from the server in seconds or ms.
2. How to get the message size.
3. Does performance gets affected if I send a longer message as "Player 1 has been connected to the game" like causing a disconnect or making message late to reach the client?
Sometimes the message takes a long time to reach the client as in another round has already begun and last round message is coming.

Comments

  • chvetsov
    Options
    hi, @Shivendra

    1. you may try to use two approaches.
    - have to synchronize your server and client with internet time. After that, you may attach timestamp on the server and check it with the time stamp on the client.
    - another approach is to get starting points in time at the begin. The client gets server time (server_ts) and its own timestamp (client_ts). Then you again attach a timestamp to every message you want and calculate a trip time using the next sample ( msg_client_ts - msg_server_ts) - (client_ts - server_ts).

    2. On Server you may override OnReceive method which gets byte[]. On client I'm not sure. @vadim could you help here

    3. Yes, performance can be affected. It takes more time to send bigger messages. Also if your message is bigger then MTU(1200) then it is split into parts. The message is treated as delivered only if all parts have arrived. Other messages also get stock in channel queue (for UDP). It case of TCP it should not be as hurtful as in case of UDP but still message size does matter.

    >Sometimes the message takes a long time to reach the client as in another round has already begun and last round message is coming.
    not sure what does this mean in case of your game. Please make sure that on the client-side you take messages from the queue often enough

    best,
    ilya