Skip to content

realtime_peer

Francisco Dias edited this page Jul 4, 2026 · 1 revision

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.

Functions

The Realtime Peer module provides the following functions:



Back To Top

photon_realtime_peer_get_state

Returns the current state of the Realtime connection.


Syntax:

photon_realtime_peer_get_state()

Returns:

Real

The connection state.



Back To Top

photon_realtime_peer_get_round_trip_time

Returns the peer's measured round-trip time to the server, in milliseconds.


Syntax:

photon_realtime_peer_get_round_trip_time()

Returns:

Real

The round-trip time in milliseconds.



Back To Top

photon_realtime_peer_get_round_trip_time_variance

Returns the variance of the peer's round-trip time, in milliseconds.


Syntax:

photon_realtime_peer_get_round_trip_time_variance()

Returns:

Real

The round-trip time variance.



Back To Top

photon_realtime_peer_get_bytes_in

Returns the total number of bytes received by the peer.


Syntax:

photon_realtime_peer_get_bytes_in()

Returns:

Real

The number of bytes received.



Back To Top

photon_realtime_peer_get_bytes_out

Returns the total number of bytes sent by the peer.


Syntax:

photon_realtime_peer_get_bytes_out()

Returns:

Real

The number of bytes sent.



Back To Top

photon_realtime_peer_get_queued_incoming_commands

Returns the number of incoming commands currently queued on the peer.


Syntax:

photon_realtime_peer_get_queued_incoming_commands()

Returns:

Real

The number of queued incoming commands.



Back To Top

photon_realtime_peer_get_queued_outgoing_commands

Returns the number of outgoing commands currently queued on the peer.


Syntax:

photon_realtime_peer_get_queued_outgoing_commands()

Returns:

Real

The number of queued outgoing commands.



Back To Top

photon_realtime_peer_get_debug_output_level

Returns the peer's debug output level.


Syntax:

photon_realtime_peer_get_debug_output_level()

Returns:

PhotonCommonDebugLevel

The debug output level.



Back To Top

photon_realtime_peer_set_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:

Boolean

Whether the value was set.



Back To Top

photon_realtime_peer_get_disconnect_timeout

Returns the peer's disconnect timeout, in milliseconds.


Syntax:

photon_realtime_peer_get_disconnect_timeout()

Returns:

Real

The disconnect timeout.



Back To Top

photon_realtime_peer_set_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:

Boolean

Whether the value was set.



Back To Top

photon_realtime_peer_get_time_ping_interval

Returns the peer's ping interval, in milliseconds.


Syntax:

photon_realtime_peer_get_time_ping_interval()

Returns:

Real

The ping interval.



Back To Top

photon_realtime_peer_set_time_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:

Boolean

Whether the value was set.



Back To Top

photon_realtime_peer_get_crc_enabled

Returns whether CRC checking is enabled on the peer.


Syntax:

photon_realtime_peer_get_crc_enabled()

Returns:

Boolean

Whether CRC checking is enabled.



Back To Top

photon_realtime_peer_set_crc_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:

Boolean

Whether the value was set.



Back To Top

photon_realtime_peer_get_packet_loss_by_crc

Returns the number of packets discarded due to a failed CRC check.


Syntax:

photon_realtime_peer_get_packet_loss_by_crc()

Returns:

Real

The number of packets lost to CRC failures.



Back To Top

photon_realtime_peer_get_timestamp_of_last_socket_receive

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:

Real

The timestamp of the last socket receive.



Back To Top

photon_realtime_peer_reset_traffic_stats

Resets the peer's traffic statistics (bytes in/out and related counters).


Syntax:

photon_realtime_peer_reset_traffic_stats()

Returns:

Boolean

Whether the statistics were reset.



Clone this wiki locally