DiscordPHP-Voice Documentation

BinaryFrame
in package

FinalYes

Table of Contents

Constants

CLIENT_HEADER_UNPACK_FORMAT  : mixed = 'Copcode'
CLIENT_MIN_HEADER_SIZE  : mixed = 1
1 byte: opcode (uint8).
SERVER_HEADER_UNPACK_FORMAT  : mixed = 'nsequence/Copcode'
SERVER_MIN_HEADER_SIZE  : mixed = 3
3 bytes: sequence (uint16 big-endian) + opcode (uint8).

Properties

$opcode  : int
$payload  : string
$sequence  : int|null

Methods

__construct()  : mixed
fromClientPayload()  : static|null
fromPayload()  : self|null
fromServerPayload()  : static|null
toClientPayload()  : string
Serialises this frame with the 1-byte client header (uint8 opcode).
toPayload()  : string
toServerPayload()  : string
Serialises this frame with the 3-byte server header (uint16 big-endian sequence + uint8 opcode).

Constants

CLIENT_HEADER_UNPACK_FORMAT

private mixed CLIENT_HEADER_UNPACK_FORMAT = 'Copcode'

CLIENT_MIN_HEADER_SIZE

1 byte: opcode (uint8).

private mixed CLIENT_MIN_HEADER_SIZE = 1

SERVER_HEADER_UNPACK_FORMAT

private mixed SERVER_HEADER_UNPACK_FORMAT = 'nsequence/Copcode'

SERVER_MIN_HEADER_SIZE

3 bytes: sequence (uint16 big-endian) + opcode (uint8).

private mixed SERVER_MIN_HEADER_SIZE = 3

Properties

Methods

__construct()

public __construct(int|null $sequence, int $opcode[, string $payload = '' ]) : mixed
Parameters
$sequence : int|null

Gateway sequence number (server frames only; null for client frames).

$opcode : int

DAVE binary opcode.

$payload : string = ''

Raw MLS/DAVE payload following the header.

fromClientPayload()

public static fromClientPayload(string $payload) : static|null
Parameters
$payload : string

Raw binary payload received from a voice gateway client.

Return values
static|null —

Null if the payload is too short to contain the client header or unpack fails.

fromPayload()

public static fromPayload(string $payload) : self|null

Use self::fromServerPayload() instead.

Parameters
$payload : string
Return values
self|null

fromServerPayload()

public static fromServerPayload(string $payload) : static|null
Parameters
$payload : string

Raw binary payload received from the voice gateway server.

Return values
static|null —

Null if the payload is too short to contain the server header or unpack fails.

toClientPayload()

Serialises this frame with the 1-byte client header (uint8 opcode).

public toClientPayload() : string
Return values
string

toPayload()

public toPayload() : string

Use self::toServerPayload() instead.

Return values
string

toServerPayload()

Serialises this frame with the 3-byte server header (uint16 big-endian sequence + uint8 opcode).

public toServerPayload() : string
Tags
throws
RuntimeException

if this frame has no sequence number.

Return values
string
On this page

Search results