Socket
About 1 min
Socket
class Socket extends \Hazaar\Warlock\Connection\WebSockets implements \Hazaar\Warlock\Connection\ConnectionProperties
bytesReceived
Total bytes received from the remote endpoint.
public int $bytesReceivedsocketLastError
Last socket error code encountered.
public int $socketLastErrorhost
Remote server host name/address.
protected string $host = '127.0.0.1'port
Remote server TCP port.
protected int $port = 13080id
Client identifier used in handshake URL.
protected string $idkey
WebSocket handshake key.
protected string $keypublic $connected
Internal connected flag.
protected bool $connectedprotocol
Protocol encoder/decoder used for payload packets.
protected Protocol $protocolframeBuffer
public string $frameBufferpayloadBuffer
public string $payloadBufferclosing
Indicates a close handshake is in progress.
protected bool $closingheaders
protected array $headersMethods
__construct
public __construct(Protocol $protocol, ?string $guid, array $headers): voidParameters
| Parameter | Type | Description |
|---|---|---|
$protocol | Protocol | |
$guid | string | |
$headers | array |
__destruct
public __destruct(): voidconfigure
Applies runtime socket connection settings.
public configure(array $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | array |
getHost
Get the host of the Warlock server.
public getHost(): stringgetPort
Get the port of the Warlock server.
public getPort(): intconnect
Connect to the Warlock server.
public connect(): boolgetLastSocketError
public getLastSocketError(bool $asString): stringParameters
| Parameter | Type | Description |
|---|---|---|
$asString | bool |
disconnect
public disconnect(): boolconnected
public connected(): boolsend
public send(PacketType $command, mixed $payload): boolParameters
| Parameter | Type | Description |
|---|---|---|
$command | PacketType | |
$payload | mixed |
recv
public recv(mixed $payload, int $tvSec = 3, int $tvUsec): nullParameters
| Parameter | Type | Description |
|---|---|---|
$payload | mixed | |
$tvSec | int | |
$tvUsec | int |
processFrame
protected processFrame(?string $frameBuffer): stringParameters
| Parameter | Type | Description |
|---|---|---|
$frameBuffer | string |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000