Documentation
¶
Index ¶
Constants ¶
const HEADER_SIZE = 5
HEADER_SIZE is the size in bytes of a reliable message header (5 bytes).
const READED_HEADER_SIZE = 14
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Header ¶
type Header struct {
Signature uint8 `json:"signature"` // Message signature (typically 0xF3)
Type Type `json:"type"` // Message type (operation, event, etc.)
EventCode uint8 `json:"event_code"` // Operation/event code (application-specific)
ParameterCount int `json:"parameter_count"` // Number of parameters following this header
}
Header represents the reliable message header. This appears at the start of the payload in SendReliable commands.
type Reliable ¶
type Reliable[P types.ParameterView] struct { Header Parameters []P // Slice of decoded parameters }
Reliable represents a complete reliable message with header and parameters. Parameters contain the actual game data as key-value pairs where each parameter has an ID, type, and value.
func Parse ¶
ParseFromReader parses a Photon reliable message from a parser.Reader. It reads the 5-byte header, then iterates through and parses each parameter as specified by the ParameterCount field.
The message format consists of:
- Header (5 bytes: signature, type, event code, parameter count)
- Parameters (ParameterCount entries, each with ID, type, and value)
Returns a Reliable struct with all fields populated including the Parameters slice, or an error if any part of parsing fails.
func ParseFragment ¶
type Type ¶
type Type uint8
Type represents a Photon reliable message type.
const ( OperationRequest Type = 0x02 // Client requests an operation OperationResponse Type = 0x07 // Server responds to an operation OtherOperationResponse Type = 0x03 // Alternative response format EventDataType Type = 0x04 // Server sends an event to client ExchangeKeys Type = 0x06 // Key exchange for encryption )
Photon Protocol reliable message types. These define the different kinds of reliable messages that can be exchanged.