-
Notifications
You must be signed in to change notification settings - Fork 0
realtime_peer
Low-level diagnostics and tuning for the Realtime connection's underlying peer: round-trip time, byte counters, queued commands, CRC checking and timeouts. These mirror the equivalent Chat peer functions in Chat Peer.
Note
Some peer statistics return a safe default when a background send/receive thread is active (Nintendo Switch only). On the shipping desktop and mobile platforms the client runs on the game thread and the values are live.
The Realtime Peer module provides the following functions:
- photon_realtime_peer_get_state
- photon_realtime_peer_get_round_trip_time
- photon_realtime_peer_get_round_trip_time_variance
- photon_realtime_peer_get_bytes_in
- photon_realtime_peer_get_bytes_out
- photon_realtime_peer_get_queued_incoming_commands
- photon_realtime_peer_get_queued_outgoing_commands
- photon_realtime_peer_get_debug_output_level
- photon_realtime_peer_set_debug_output_level
- photon_realtime_peer_get_disconnect_timeout
- photon_realtime_peer_set_disconnect_timeout
- photon_realtime_peer_get_time_ping_interval
- photon_realtime_peer_set_time_ping_interval
- photon_realtime_peer_get_crc_enabled
- photon_realtime_peer_set_crc_enabled
- photon_realtime_peer_get_packet_loss_by_crc
- photon_realtime_peer_get_timestamp_of_last_socket_receive
- photon_realtime_peer_reset_traffic_stats
Returns the current state of the Realtime connection.
Syntax:
photon_realtime_peer_get_state()
Returns:
The connection state.
Returns the peer's measured round-trip time to the server, in milliseconds.
Syntax:
photon_realtime_peer_get_round_trip_time()
Returns:
The round-trip time in milliseconds.
Returns the variance of the peer's round-trip time, in milliseconds.
Syntax:
photon_realtime_peer_get_round_trip_time_variance()
Returns:
The round-trip time variance.
Returns the total number of bytes received by the peer.
Syntax:
photon_realtime_peer_get_bytes_in()
Returns:
The number of bytes received.
Returns the total number of bytes sent by the peer.
Syntax:
photon_realtime_peer_get_bytes_out()
Returns:
The number of bytes sent.
Returns the number of incoming commands currently queued on the peer.
Syntax:
photon_realtime_peer_get_queued_incoming_commands()
Returns:
The number of queued incoming commands.
Returns the number of outgoing commands currently queued on the peer.
Syntax:
photon_realtime_peer_get_queued_outgoing_commands()
Returns:
The number of queued outgoing commands.
Returns the peer's debug output level.
Syntax:
photon_realtime_peer_get_debug_output_level()
Returns:
The debug output level.
Sets the peer's debug output level.
Syntax:
photon_realtime_peer_set_debug_output_level(level)
| Argument | Type | Description |
|---|---|---|
| level | PhotonCommonDebugLevel | The debug output level to apply. |
Returns:
Whether the value was set.
Returns the peer's disconnect timeout, in milliseconds.
Syntax:
photon_realtime_peer_get_disconnect_timeout()
Returns:
The disconnect timeout.
Sets the peer's disconnect timeout, in milliseconds.
Syntax:
photon_realtime_peer_set_disconnect_timeout(timeout_ms)
| Argument | Type | Description |
|---|---|---|
| timeout_ms | Real | The timeout in milliseconds. |
Returns:
Whether the value was set.
Returns the peer's ping interval, in milliseconds.
Syntax:
photon_realtime_peer_get_time_ping_interval()
Returns:
The ping interval.
Sets the peer's ping interval, in milliseconds.
Syntax:
photon_realtime_peer_set_time_ping_interval(interval_ms)
| Argument | Type | Description |
|---|---|---|
| interval_ms | Real | The ping interval in milliseconds. |
Returns:
Whether the value was set.
Returns whether CRC checking is enabled on the peer.
Syntax:
photon_realtime_peer_get_crc_enabled()
Returns:
Whether CRC checking is enabled.
Enables or disables CRC checking on the peer. CRC adds a small overhead but detects corrupted packets.
Syntax:
photon_realtime_peer_set_crc_enabled(enabled)
| Argument | Type | Description |
|---|---|---|
| enabled | Boolean | Whether to enable CRC checking. |
Returns:
Whether the value was set.
Returns the number of packets discarded due to a failed CRC check.
Syntax:
photon_realtime_peer_get_packet_loss_by_crc()
Returns:
The number of packets lost to CRC failures.
Returns the timestamp (in milliseconds) of the last data received on the peer's socket.
Syntax:
photon_realtime_peer_get_timestamp_of_last_socket_receive()
Returns:
The timestamp of the last socket receive.
Resets the peer's traffic statistics (bytes in/out and related counters).
Syntax:
photon_realtime_peer_reset_traffic_stats()
Returns:
Whether the statistics were reset.
GameMaker 2026