Signal
Reference for the Signal module: every class and function, with its full signature, parameters and return type. Triggers real-time broadcasts to WebSocket clients through a signal server, resolves the server connection details from a running container, and reports request failures as a typed error.
This page is a pure reference. It documents only what the module's source defines: the service that triggers a broadcast, the lookup that resolves a running signal server, the service data object that carries its connection details, and the error raised when a request to the signal server fails.
SignalService- triggers a real-time broadcast on the signal server for subscribers of a channel.SignalDatabase- resolves the connection details of a running signal container.SignalServiceData- the resolved connection details of a signal server: WebSocket URL, HTTP URL and admin token.SignalTokenError- thrown when a signal server request fails or does not return a successful status.
SignalService
Interact with the signal server. Provides a static function to trigger a broadcast to the WebSocket clients subscribed to a channel id. Frontend session tokens are minted elsewhere, not by this class.
Trigger
SignalService::Trigger(string $serverUrl, string $adminToken, string $channelIdHex32): void
Triggers a signal to connected WebSocket clients subscribed to this channel id. Sends a PUT to the signal server's admin API with the admin token; subscribers receive a WebSocket text frame equal to the channel id.
| Name | Type | Description |
|---|---|---|
$serverUrl | string | The HTTP URL of the signal server (admin API). |
$adminToken | string | The admin authentication token for the signal server. |
$channelIdHex32 | string | Opaque 32-character lowercase hex channel id (same as in the channel token). |
Returns void
SignalDatabase
Resolve the connection details of a signal server. Provides a static function that queries the Cloud module for a running signal container and returns its connection details.
GetServiceData
SignalDatabase::GetServiceData(): SignalServiceData
Gets Signal service data (WebSocket URL, HTTP URL and admin token) by querying the Cloud module for running signal containers, picking one at random. Throws when no running container is found or its admin token is missing.
Returns SignalServiceData The service data object containing the WebSocket URL, HTTP URL and admin token.
SignalServiceData
The resolved connection details of a signal server: its WebSocket URL, HTTP URL and admin token. A plain data object.
Properties
| Name | Type | Description |
|---|---|---|
$websocketUrl | string | The WebSocket URL of the signal server. |
$httpUrl | string | The HTTP URL of the signal server. |
$adminToken | string | The admin authentication token for the signal server. |
__construct
SignalServiceData::__construct(string $websocketUrl, string $httpUrl, string $adminToken)
Create the service data. Validates that the WebSocket URL and HTTP URL are URLs and that the admin token is a string.
| Name | Type | Description |
|---|---|---|
$websocketUrl | string | The WebSocket URL of the signal server. |
$httpUrl | string | The HTTP URL of the signal server. |
$adminToken | string | The admin authentication token for the signal server. |
SignalTokenError
A custom exception for Signal service token-related errors, thrown when a request to the
signal server fails or does not return a successful status. Extends
Exception.
__construct
SignalTokenError::__construct(string $message = "", int $code = 0, Exception $previous = null)
Constructs a new SignalTokenError.
| Name | Type | Description |
|---|---|---|
$message | string | The error message. |
$code | int | The error code (default: 0). |
$previous | Exception|null | The previous exception for chaining. |