Skip to content

chat_peer

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

Chat Peer

Low-level diagnostics and tuning for the Chat connection's underlying peer: round-trip time, byte counters, queued commands, CRC checking and timeouts. These mirror the equivalent Realtime peer functions in Realtime Peer.

Note

These getters return a safe default when Chat is running with a background send/receive thread (Nintendo Switch only). On the shipping desktop and mobile platforms the client runs on the game thread and the values are live.

Functions

The Chat Peer module provides the following functions:



Back To Top

photon_chat_peer_get_state

Returns the current state of the Chat connection.


Syntax:

photon_chat_peer_get_state()

Returns:

Real

The connection state.



Back To Top

photon_chat_peer_get_round_trip_time

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


Syntax:

photon_chat_peer_get_round_trip_time()

Returns:

Real

The round-trip time in milliseconds.



Back To Top

photon_chat_peer_get_round_trip_time_variance

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


Syntax:

photon_chat_peer_get_round_trip_time_variance()

Returns:

Real

The round-trip time variance.



Back To Top

photon_chat_peer_get_bytes_in

Returns the total number of bytes received by the Chat peer.


Syntax:

photon_chat_peer_get_bytes_in()

Returns:

Real

The number of bytes received.



Back To Top

photon_chat_peer_get_bytes_out

Returns the total number of bytes sent by the Chat peer.


Syntax:

photon_chat_peer_get_bytes_out()

Returns:

Real

The number of bytes sent.



Back To Top

photon_chat_peer_get_queued_incoming_commands

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


Syntax:

photon_chat_peer_get_queued_incoming_commands()

Returns:

Real

The number of queued incoming commands.



Back To Top

photon_chat_peer_get_queued_outgoing_commands

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


Syntax:

photon_chat_peer_get_queued_outgoing_commands()

Returns:

Real

The number of queued outgoing commands.



Back To Top

photon_chat_peer_get_debug_output_level

Returns the Chat peer's debug output level.


Syntax:

photon_chat_peer_get_debug_output_level()

Returns:

PhotonCommonDebugLevel

The debug output level.



Back To Top

photon_chat_peer_set_debug_output_level

Sets the Chat peer's debug output level.


Syntax:

photon_chat_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_chat_peer_get_disconnect_timeout

Returns the Chat peer's disconnect timeout, in milliseconds.


Syntax:

photon_chat_peer_get_disconnect_timeout()

Returns:

Real

The disconnect timeout.



Back To Top

photon_chat_peer_set_disconnect_timeout

Sets the Chat peer's disconnect timeout, in milliseconds.


Syntax:

photon_chat_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_chat_peer_get_time_ping_interval

Returns the Chat peer's ping interval, in milliseconds.


Syntax:

photon_chat_peer_get_time_ping_interval()

Returns:

Real

The ping interval.



Back To Top

photon_chat_peer_set_time_ping_interval

Sets the Chat peer's ping interval, in milliseconds.


Syntax:

photon_chat_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_chat_peer_get_crc_enabled

Returns whether CRC checking is enabled on the Chat peer.


Syntax:

photon_chat_peer_get_crc_enabled()

Returns:

Boolean

Whether CRC checking is enabled.



Back To Top

photon_chat_peer_set_crc_enabled

Enables or disables CRC checking on the Chat peer. CRC adds a small overhead but detects corrupted packets.


Syntax:

photon_chat_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_chat_peer_get_packet_loss_by_crc

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


Syntax:

photon_chat_peer_get_packet_loss_by_crc()

Returns:

Real

The number of packets lost to CRC failures.



Back To Top

photon_chat_peer_get_timestamp_of_last_socket_receive

Returns the timestamp (in milliseconds) of the last data received on the Chat peer's socket.


Syntax:

photon_chat_peer_get_timestamp_of_last_socket_receive()

Returns:

Real

The timestamp of the last socket receive.



Back To Top

photon_chat_peer_reset_traffic_stats

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


Syntax:

photon_chat_peer_reset_traffic_stats()

Returns:

Boolean

Whether the statistics were reset.



Clone this wiki locally