Peer
Less than 1 minute
Peer
Server-side client wrapper for cluster peer connections.
class Peer extends \Hazaar\Warlock\Server\Client\ClientProperties
type
Fixed client type for cluster peers.
public ClientType $type = 'ClientType'status
Current peer connection state.
public PeerStatus $status = 'PeerStatus'reconnectTimeout
Minimum seconds between reconnect attempts.
private int $reconnectTimeout = 15lastConnectAttempt
Timestamp of the most recent connect attempt.
private int $lastConnectAttemptMethods
__construct
public __construct(Main $main, mixed $stream, ?array $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$main | Main | server runtime instance |
$stream | mixed | existing stream resource, if any |
$options | array | peer/client options |
__destruct
Emits peer destruction diagnostics.
public __destruct(): voidinitiateHandshake
Handles websocket handshake initiation for peer connections.
public initiateHandshake(string $request, array $headers): boolParameters
| Parameter | Type | Description |
|---|---|---|
$request | string | |
$headers | array |
process
Advances peer connection state machine and IO handling.
public process(): voidrecv
Processes incoming data according to current peer status phase.
public recv(string $buf): voidParameters
| Parameter | Type | Description |
|---|---|---|
$buf | string |
status
Returns human-readable peer status text.
public status(): stringconnect
Initiates asynchronous TCP connection to configured peer endpoint.
public connect(): booldisconnect
public disconnect(): boolisConnected
public isConnected(): boolsendEvent
public sendEvent(string $eventID, string $triggerID, mixed $data): boolParameters
| Parameter | Type | Description |
|---|---|---|
$eventID | string | |
$triggerID | string | |
$data | mixed |
processCommand
protected processCommand(PacketType $command, mixed $payload): boolParameters
| Parameter | Type | Description |
|---|---|---|
$command | PacketType | |
$payload | mixed |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000