Connection
Less than 1 minute
Connection
Contract for Warlock transport connections.
interface ConnectionMethods
__construct
Creates a connection implementation bound to a Warlock protocol handler.
public __construct(Protocol $protocol, ?string $guid): voidParameters
| Parameter | Type | Description |
|---|---|---|
$protocol | Hazaar\Warlock\Protocol | |
$guid | string |
configure
Configure the connection.
public configure(array $config): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$config | array |
addHeaders
Add custom headers to the connection handshake request.
public addHeaders(array $headers): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$headers | array |
getHost
Returns the connection host name or address.
public getHost(): stringReturns: string
getPort
Returns the remote connection port.
public getPort(): intReturns: int
connect
Opens the underlying connection.
public connect(): boolReturns: bool
disconnect
Closes the underlying connection.
public disconnect(): boolReturns: bool
connected
Returns whether the underlying transport is currently connected.
public connected(): boolReturns: bool
send
Sends a command packet over the connection.
public send(PacketType $command, mixed $payload): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$command | Hazaar\Warlock\Enum\PacketType | |
$payload | mixed |
recv
Receives a packet and optionally writes its payload by reference.
public recv(mixed $payload, int $tvSec = 3, int $tvUsec): bool|PacketType|nullReturns: bool|Hazaar\Warlock\Enum\PacketType|null
Parameters
| Parameter | Type | Description |
|---|---|---|
$payload | mixed | |
$tvSec | int | |
$tvUsec | int |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000