Stream
in package
Tags
Table of Contents
Methods
- poll() : array<string|int, string>
- Fetches and clears pending messages for a session from the DB queue.
- publish() : void
- Publishes one JSON-RPC message (already json_encode()'d) to a session.
- subscribe_blocking() : void
- Blocks subscribing to the session's Redis channel, calling $on_message($payload_json) for every message published to it.
Methods
poll()
Fetches and clears pending messages for a session from the DB queue.
public
static poll(string $session_id) : array<string|int, string>
Only used when Config::REDIS is disabled.
Parameters
- $session_id : string
Return values
array<string|int, string> —payload_json strings, oldest first
publish()
Publishes one JSON-RPC message (already json_encode()'d) to a session.
public
static publish(string $session_id, string $payload_json) : void
Parameters
- $session_id : string
- $payload_json : string
subscribe_blocking()
Blocks subscribing to the session's Redis channel, calling $on_message($payload_json) for every message published to it.
public
static subscribe_blocking(string $session_id, callable $on_message) : void
Only used when Config::REDIS is enabled.
Parameters
- $session_id : string
- $on_message : callable