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

Common

The Common module holds functionality shared across the Photon subsystems: SDK debug output control, serialization info, and helpers for turning Photon's numeric state, cause and type codes into readable strings.

Functions

The Common module provides the following functions:

Constants

The Common module defines the following constants:



Back To Top

photon_common_set_debug_level

Sets the verbosity of the Photon SDK's internal debug output. Higher levels print more diagnostic information from the underlying client and are useful while developing, but should usually be lowered for release builds.


Syntax:

photon_common_set_debug_level(level)
Argument Type Description
level PhotonCommonDebugLevel The debug output level to apply.

Returns:

Boolean

Whether the level was applied successfully.


Example:

photon_common_set_debug_level(PhotonCommonDebugLevel.Warnings);

The above code limits the SDK debug output to warnings and errors.



Back To Top

photon_common_get_debug_level

Returns the current Photon SDK debug output level, as set by photon_common_set_debug_level.


Syntax:

photon_common_get_debug_level()

Returns:

PhotonCommonDebugLevel

The current debug output level.



Back To Top

photon_common_get_serialization_protocol

Returns the serialization protocol the client uses to encode data on the wire.


Syntax:

photon_common_get_serialization_protocol()

Returns:

PhotonCommonSerializationProtocol

The active serialization protocol.



Back To Top

photon_common_type_code_to_string

Converts a Photon wire type code into a human-readable string. This is primarily a debugging aid when inspecting the raw types received from custom events or properties.


Syntax:

photon_common_type_code_to_string(type_code)
Argument Type Description
type_code PhotonCommonTypeCode The type code to convert.

Returns:

String

A readable name for the type code.


Example:

show_debug_message(photon_common_type_code_to_string(PhotonCommonTypeCode.Integer)); // "Integer"


Back To Top

photon_common_get_sdk_version

Returns the version string of the underlying Photon C++ SDK bundled with the extension.


Syntax:

photon_common_get_sdk_version()

Returns:

String

The Photon SDK version.



Back To Top

photon_common_client_state_to_string

Converts a client state value into a human-readable string. Pass a PhotonRealtimeState or PhotonChatState value depending on which client the state came from.


Syntax:

photon_common_client_state_to_string(state)
Argument Type Description
state Real The client state value to convert.

Returns:

String

A readable name for the state.



Back To Top

photon_common_disconnect_cause_to_string

Converts a disconnect cause value into a human-readable string. Pass a PhotonRealtimeDisconnectCause or PhotonChatDisconnectCause value depending on which client reported the disconnect.


Syntax:

photon_common_disconnect_cause_to_string(cause)
Argument Type Description
cause Real The disconnect cause value to convert.

Returns:

String

A readable name for the disconnect cause.



Back To Top

PhotonCommonDebugLevel

The Photon SDK debug output levels, used with photon_common_set_debug_level and photon_common_get_debug_level.

These constants are referenced by the following functions:


Member Description
Off No debug output.
Errors Only errors.
Warnings Errors and warnings.
Info Errors, warnings and informational messages.
All All debug output, including verbose messages.


Back To Top

PhotonCommonSerializationProtocol

The serialization protocols the client can use to encode data on the wire, returned by photon_common_get_serialization_protocol.

These constants are referenced by the following functions:


Member Description
Protocol16 Photon serialization protocol 1.6.
Protocol18 Photon serialization protocol 1.8.


Back To Top

PhotonCommonTypeCode

The wire type codes Photon uses to tag serialized values. Returned in the readable form by photon_common_type_code_to_string, and useful when interpreting values received from custom events and properties.

These constants are referenced by the following functions:


Member Description
Byte An 8-bit unsigned integer.
Short A 16-bit signed integer.
Integer A 32-bit signed integer.
Long A 64-bit signed integer.
Float A 32-bit floating point value.
Double A 64-bit floating point value.
Boolean A boolean value.
String A string value.
Hashtable A Photon hashtable.
Dictionary A typed dictionary.
Object A generic object.
Array An array of typed values.
ByteArray An array of bytes.
PhotonCommand An internal Photon command.
Null A null value.
Custom A registered custom type.
Unknown An unknown type.
Invalid An invalid type.


Back To Top

PhotonCommonInternalLogLevel

The extension's own logging levels (distinct from the Photon SDK debug level). This corresponds to the extension's Log Level option.


Member Description
Off No logging.
Fatal Only fatal errors.
Error Errors and above.
Warning Warnings and above.
Info Informational messages and above.
Debug Debug messages and above.
DebugVerbose All messages, including verbose debug output.


Clone this wiki locally