-
Notifications
You must be signed in to change notification settings - Fork 0
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.
The Chat Peer module provides the following functions:
- photon_chat_peer_get_state
- photon_chat_peer_get_round_trip_time
- photon_chat_peer_get_round_trip_time_variance
- photon_chat_peer_get_bytes_in
- photon_chat_peer_get_bytes_out
- photon_chat_peer_get_queued_incoming_commands
- photon_chat_peer_get_queued_outgoing_commands
- photon_chat_peer_get_debug_output_level
- photon_chat_peer_set_debug_output_level
- photon_chat_peer_get_disconnect_timeout
- photon_chat_peer_set_disconnect_timeout
- photon_chat_peer_get_time_ping_interval
- photon_chat_peer_set_time_ping_interval
- photon_chat_peer_get_crc_enabled
- photon_chat_peer_set_crc_enabled
- photon_chat_peer_get_packet_loss_by_crc
- photon_chat_peer_get_timestamp_of_last_socket_receive
- photon_chat_peer_reset_traffic_stats
Returns the current state of the Chat connection.
Syntax:
photon_chat_peer_get_state()
Returns:
The connection state.
Returns the Chat peer's measured round-trip time to the server, in milliseconds.
Syntax:
photon_chat_peer_get_round_trip_time()
Returns:
The round-trip time in milliseconds.
Returns the variance of the Chat peer's round-trip time, in milliseconds.
Syntax:
photon_chat_peer_get_round_trip_time_variance()
Returns:
The round-trip time variance.
Returns the total number of bytes received by the Chat peer.
Syntax:
photon_chat_peer_get_bytes_in()
Returns:
The number of bytes received.
Returns the total number of bytes sent by the Chat peer.
Syntax:
photon_chat_peer_get_bytes_out()
Returns:
The number of bytes sent.
Returns the number of incoming commands currently queued on the Chat peer.
Syntax:
photon_chat_peer_get_queued_incoming_commands()
Returns:
The number of queued incoming commands.
Returns the number of outgoing commands currently queued on the Chat peer.
Syntax:
photon_chat_peer_get_queued_outgoing_commands()
Returns:
The number of queued outgoing commands.
Returns the Chat peer's debug output level.
Syntax:
photon_chat_peer_get_debug_output_level()
Returns:
The 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:
Whether the value was set.
Returns the Chat peer's disconnect timeout, in milliseconds.
Syntax:
photon_chat_peer_get_disconnect_timeout()
Returns:
The 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:
Whether the value was set.
Returns the Chat peer's ping interval, in milliseconds.
Syntax:
photon_chat_peer_get_time_ping_interval()
Returns:
The 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:
Whether the value was set.
Returns whether CRC checking is enabled on the Chat peer.
Syntax:
photon_chat_peer_get_crc_enabled()
Returns:
Whether CRC checking is 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:
Whether the value was set.
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:
The number of packets lost to CRC failures.
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:
The timestamp of the last socket receive.
Resets the Chat peer's traffic statistics (bytes in/out and related counters).
Syntax:
photon_chat_peer_reset_traffic_stats()
Returns:
Whether the statistics were reset.
GameMaker 2026