reliable

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HEADER_SIZE = 5

HEADER_SIZE is the size in bytes of a reliable message header (5 bytes).

View Source
const READED_HEADER_SIZE = 14

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragment

type Fragment struct {
	types.Fragment
}
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

func Parse[P types.ParameterView](ctx *context.Context[P], length uint32) (*Reliable[P], error)

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

func ParseFragment[P types.ParameterView](ctx *context.Context[P], length uint32) (*Reliable[P], error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL