Message
About 1 min
Message
class MessageProperties
method
the JSON-RPC method name
public readonly string $methodType: string
params
the request parameters, structured rather than positional
public readonly array $paramsType: array
id
the request id, or null for a notification
public readonly mixed $idType: mixed
isNotification
whether the message omitted id entirely
public readonly bool $isNotificationType: bool
Methods
__construct
public __construct(string $method, array $params, mixed $id, bool $isNotification): voidParameters
| Parameter | Type | Description |
|---|---|---|
$method | string | the JSON-RPC method name |
$params | array | the request parameters, structured rather than positional |
$id | mixed | the request id, or null for a notification |
$isNotification | bool | whether the message omitted id entirely |
fromJSON
Parses a raw request body into a message.
public fromJSON(string $json): selfReturns: self
Parameters
| Parameter | Type | Description |
|---|---|---|
$json | string | the raw request body |
getMeta
Returns the request metadata carried in params._meta.
public getMeta(): arrayReturns: array
getProtocolVersion
Returns the protocol version the request declares, if any.
public getProtocolVersion(): ?stringReturns: string
result
Wraps a handler's return value in a JSON-RPC success envelope.
public result(mixed $id, array $result, array $serverInfo): arrayReturns: array
resultType and the server identity are applied here so individual handlers never deal with the envelope.
Parameters
| Parameter | Type | Description |
|---|---|---|
$id | mixed | the id of the request being answered |
$result | array | the result payload |
$serverInfo | array | the server name and version |
error
Builds a JSON-RPC error envelope.
public error(mixed $id, int $code, string $message, mixed $data): arrayReturns: array
Parameters
| Parameter | Type | Description |
|---|---|---|
$id | mixed | the id of the request being answered, or null when it could not be read |
$code | int | the JSON-RPC error code |
$message | string | the error message |
$data | mixed | optional structured payload |
Generated by Hazaar API Doc Generator on Sun, 23 Aug 2026 10:49:44 +0000