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

Peer & Network Simulation

This module holds the QA network-simulation controls and the shared low-level peer constants used across the extension.

Warning

Network simulation is a QA/debug aid. It is not supported by the bundled SDK build and the getters report as disabled; treat these functions as no-ops on the shipping platforms.

Network simulation

Simulate poor network conditions for testing:

Constants

The Peer module defines the following shared constants:



Back To Top

photon_peer_network_sim_get_enabled

Returns whether network simulation (artificial lag, jitter and packet loss) is enabled.


Syntax:

photon_peer_network_sim_get_enabled()

Returns:

Boolean

Whether network simulation is enabled.



Back To Top

photon_peer_network_sim_set_enabled

Enables or disables network simulation for testing poor network conditions.


Syntax:

photon_peer_network_sim_set_enabled(enabled)
Argument Type Description
enabled Boolean Whether to enable network simulation.

Returns:

Boolean

Whether the value was set.



Back To Top

photon_peer_network_sim_set_lag

Sets the artificial incoming and outgoing lag, in milliseconds.


Syntax:

photon_peer_network_sim_set_lag(incoming_ms, outgoing_ms)
Argument Type Description
incoming_ms Real The incoming lag in milliseconds.
outgoing_ms Real The outgoing lag in milliseconds.

Returns:

Boolean

Whether the values were set.



Back To Top

photon_peer_network_sim_set_jitter

Sets the artificial incoming and outgoing jitter, in milliseconds.


Syntax:

photon_peer_network_sim_set_jitter(incoming_ms, outgoing_ms)
Argument Type Description
incoming_ms Real The incoming jitter in milliseconds.
outgoing_ms Real The outgoing jitter in milliseconds.

Returns:

Boolean

Whether the values were set.



Back To Top

photon_peer_network_sim_set_packet_loss

Sets the artificial incoming and outgoing packet-loss percentages.


Syntax:

photon_peer_network_sim_set_packet_loss(incoming_pct, outgoing_pct)
Argument Type Description
incoming_pct Real The incoming packet-loss percentage.
outgoing_pct Real The outgoing packet-loss percentage.

Returns:

Boolean

Whether the values were set.



Back To Top

PhotonPeerConnectionProtocol

The transport protocols a peer can use.


Member Description
Udp UDP transport.
Tcp TCP transport.
Ws WebSocket transport.
Wss Secure WebSocket transport.


Back To Top

PhotonPeerState

The low-level peer connection states.


Member Description
Disconnected The peer is disconnected.
Connecting The peer is connecting.
InitializingApplication The peer is initialising the application layer.
Connected The peer is connected.
Disconnecting The peer is disconnecting.


Back To Top

PhotonPeerStatusCode

Low-level peer status codes. Primarily useful for diagnostics.


Member Description
ExceptionOnConnect An exception occurred while connecting.
Connect The peer connected.
Disconnect The peer disconnected.
Exception A peer exception occurred.
QueueOutgoingReliableWarning The outgoing reliable queue is filling up.
QueueOutgoingUnreliableWarning The outgoing unreliable queue is filling up.
SendError A send error occurred.
QueueOutgoingAcksWarning The outgoing acknowledgement queue is filling up.
QueueIncomingReliableWarning The incoming reliable queue is filling up.
QueueIncomingUnreliableWarning The incoming unreliable queue is filling up.
QueueSentWarning The sent queue is filling up.
InternalReceiveException An internal receive exception occurred.
TimeoutDisconnect The connection timed out.
DisconnectByServer The server closed the connection.
DisconnectByServerUserLimit The server closed the connection due to its user limit.
DisconnectByServerLogic Server-side logic closed the connection.
EncryptionEstablished Encryption was established.
EncryptionFailedToEstablish Encryption failed to establish.


Back To Top

PhotonPeerCoreErrorCode

Core (protocol-level) error codes. Primarily useful for diagnostics.


Member Description
Ok No error.
InternalServerError An internal server error occurred.
OperationInvalid The operation was invalid.
OperationDenied The operation was denied.
ArgumentOutOfRange An argument was out of range.
InvalidRequestParameters The request parameters were invalid.
NotReady The server is not ready.
Overload The server is overloaded.
Backoff The client should back off and retry later.
Maintenance The server is under maintenance.
SendBufferFull The send buffer is full.
UnexpectedData Unexpected data was received.
SerializationLimitError A serialization limit was exceeded.
WrongInitRequestData The initialization request data was wrong.
ResponseParseError A response could not be parsed.
CryptoProviderNotSet The crypto provider was not set.
DecryptionFailure Decryption failed.
InvalidEncryptionParameters The encryption parameters were invalid.
IncomingDataRateExceeded The incoming data rate was exceeded.
IncomingMsgRateExceeded The incoming message rate was exceeded.
IncomingMaxMsgSizeExceeded The incoming maximum message size was exceeded.
OperationMaxCountExceeded The operation count limit was exceeded.
OperationRateExceeded The operation rate was exceeded.
OperationDataRateExceeded The operation data rate was exceeded.
OperationBlocked The operation was blocked.
OperationSizeLimitExceeded The operation size limit was exceeded.
OperationParametersLimit The operation parameters limit was exceeded.
MessagesRateExceeded The message rate was exceeded.
MessagesDataRateExceeded The message data rate was exceeded.
MessagesBlocked Messages were blocked.
MessageSizeLimitExceeded The message size limit was exceeded.


Back To Top

PhotonPeerLiteOperationCode

The Lite protocol operation codes. Primarily useful for diagnostics.


Member Description
Join Join a room.
Leave Leave a room.
RaiseEvent Raise an event.
SetProperties Set properties.
GetProperties Get properties.
ChangeGroups Change interest groups.


Back To Top

PhotonPeerLiteEventCode

The Lite protocol event codes. Primarily useful for diagnostics.


Member Description
Join A player joined.
Leave A player left.
PropertiesChanged Properties changed.


Back To Top

PhotonPeerLiteParameterCode

The Lite protocol parameter codes. Primarily useful for diagnostics.


Member Description
GameId The game ID parameter.
ActorNr The actor number parameter.
TargetActorNr The target actor number parameter.
ActorList The actor list parameter.
Properties The properties parameter.
Broadcast The broadcast flag parameter.
ActorProperties The actor properties parameter.
GameProperties The game properties parameter.
Cache The cache parameter.
ReceiverGroup The receiver group parameter.
Data The data parameter.
Code The code parameter.
Group The group parameter.
Remove The remove parameter.
Add The add parameter.


Clone this wiki locally