WebSockets
Less than 1 minute
WebSockets
- Full name:
\Hazaar\Warlock\Protocol\WebSockets
- This class is an Abstract class
Properties
allowed_protocols
protected string[] $allowed_protocols
magicGUID
private string $magicGUID
headers
private string[] $headers
Methods
__construct
public __construct(string[] $allowed_protocols = []): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$allowed_protocols | string[] |
parseHeaders
public parseHeaders(string $request, string& $body = ''): string[]
Parameters:
Parameter | Type | Description |
---|---|---|
$request | string | |
$body | string |
createHandshake
protected createHandshake(string $path, string $host, ?string $origin, string $key, string[] $extra_headers = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$path | string | |
$host | string | |
$origin | ?string | |
$key | string | |
$extra_headers | string[] |
acceptHandshake
protected acceptHandshake(string[] $headers, string[]& $responseHeaders = [], ?string $key = null, string[]& $results = []): bool|int
Parameters:
Parameter | Type | Description |
---|---|---|
$headers | string[] | |
$responseHeaders | string[] | |
$key | ?string | |
$results | string[] |
frame
protected frame(string $payload, ?string $type = null, bool $masked = true): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$payload | string | |
$type | ?string | |
$masked | bool |
getFrame
protected getFrame(string& $buffer, ?string& $payload = null): bool|int
Parameters:
Parameter | Type | Description |
---|---|---|
$buffer | string | |
$payload | ?string |
checkHost
protected checkHost(string $host): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$host | string |
checkRequestURL
protected checkRequestURL(string $path): array<string,int|string>|bool
Parameters:
Parameter | Type | Description |
---|---|---|
$path | string |
checkOrigin
protected checkOrigin(string $origin): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$origin | string |
checkProtocol
protected checkProtocol(string[]|string $protocols): string[]|false
Parameters:
Parameter | Type | Description |
---|---|---|
$protocols | string[]|string |
hexString
protected hexString(string $string): string[]
Parameters:
Parameter | Type | Description |
---|---|---|
$string | string |
getFrameHeaders
private getFrameHeaders(string $frame): (int|string)[]
Parameters:
Parameter | Type | Description |
---|---|---|
$frame | string |
applyMask
private applyMask(string[] $headers, string $payload): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$headers | string[] | |
$payload | string |
Automatically generated on 2024-11-14