class Context

Constants

FD

Properties

static protected array $storage

Methods

static mixed
set(string $id, mixed $value)

Set a value in the WebSocket context.

static mixed
get(string $id, mixed $default = null, int|null $fd = null)

Get a value from the WebSocket context.

static bool
has(string $id, int|null $fd = null)

Determine if a value exists in the WebSocket context.

static void
forget(string $id)

Remove a value from the WebSocket context.

static void
release(int|null $fd = null)

Release all context data for a file descriptor.

static void
copyFrom(int $fromFd, array $keys = [])

Copy context data from another file descriptor into the current one.

static mixed
override(string $id, Closure $closure)

Override a value in the WebSocket context using a callback.

static mixed
getOrSet(string $id, mixed $value)

Get a value from the context, or set and return a default.

static array
getStorage()

Get the entire context storage.

static void
flushState()

Flush all static state.

Details

at line 20
static mixed set(string $id, mixed $value)

Set a value in the WebSocket context.

Parameters

string $id
mixed $value

Return Value

mixed

at line 31
static mixed get(string $id, mixed $default = null, int|null $fd = null)

Get a value from the WebSocket context.

Parameters

string $id
mixed $default
int|null $fd

Return Value

mixed

at line 41
static bool has(string $id, int|null $fd = null)

Determine if a value exists in the WebSocket context.

Parameters

string $id
int|null $fd

Return Value

bool

at line 52
static void forget(string $id)

Remove a value from the WebSocket context.

Parameters

string $id

Return Value

void

at line 63
static void release(int|null $fd = null)

Release all context data for a file descriptor.

Parameters

int|null $fd

Return Value

void

at line 77
static void copyFrom(int $fromFd, array $keys = [])

Copy context data from another file descriptor into the current one.

Merges into the current FD's context — existing values that are not in the source are preserved. Matching keys are overwritten.

Parameters

int $fromFd
array $keys

Return Value

void

at line 106
static mixed override(string $id, Closure $closure)

Override a value in the WebSocket context using a callback.

Parameters

string $id
Closure $closure

Return Value

mixed

at line 120
static mixed getOrSet(string $id, mixed $value)

Get a value from the context, or set and return a default.

Parameters

string $id
mixed $value

Return Value

mixed

at line 131
static array getStorage()

Get the entire context storage.

Return Value

array

at line 139
static void flushState()

Flush all static state.

Return Value

void