Peer
Peer
Server-side client wrapper for cluster peer connections.
class Peer extends \Hazaar\Warlock\Server\ClientExtends: Hazaar\Warlock\Server\Client
Properties
type
Fixed client type for cluster peers.
public ClientType $type = 'ClientType'Type: Hazaar\Warlock\Enum\ClientType
peerStatus
Current peer connection state.
public PeerStatus $peerStatus = 'PeerStatus'Type: Hazaar\Warlock\Enum\PeerStatus
reconnectTimeout
Minimum seconds between reconnect attempts.
private int $reconnectTimeout = 15Type: int
lastConnectAttempt
Timestamp of the most recent connect attempt.
private int $lastConnectAttemptType: int
Methods
__construct
public __construct(Main $main, mixed $stream, ?array $options): voidParameters
| Parameter | Type | Description |
|---|---|---|
$main | Hazaar\Warlock\Server\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): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$request | string | |
$headers | array |
process
Advances peer connection state machine and IO handling.
public process(): voidReturns: void
recv
Processes incoming data according to current peer status phase.
public recv(string $buf): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$buf | string |
status
Returns human-readable peer status text.
public status(): stringReturns: string
connect
Initiates asynchronous TCP connection to configured peer endpoint.
public connect(): boolReturns: bool
disconnect
public disconnect(): boolReturns: bool
isConnected
public isConnected(): boolReturns: bool
sendEvent
public sendEvent(string $eventID, string $triggerID, mixed $data): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$eventID | string | |
$triggerID | string | |
$data | mixed |
processCommand
protected processCommand(PacketType $command, mixed $payload): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$command | Hazaar\Warlock\Enum\PacketType | |
$payload | mixed |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000