Hazaar Application Protocol Class
The Application Protocol is a simple protocol developed to allow communication between parts of the Hazaar framework over the wire or other IO interfaces. It allows common information to be encoded/decoded between endpoints.
public array $typeCodes = array (
0 => 'DEBUG',
1 => NULL,
2 => NULL,
3 => NULL,
4 => NULL,
5 => NULL,
6 => NULL,
7 => NULL,
8 => NULL,
9 => NULL,
10 => NULL,
11 => NULL,
12 => NULL,
13 => NULL,
14 => NULL,
15 => NULL,
16 => NULL,
17 => NULL,
18 => NULL,
19 => NULL,
20 => NULL,
21 => NULL,
22 => NULL,
23 => NULL,
24 => NULL,
25 => NULL,
26 => NULL,
27 => NULL,
28 => NULL,
29 => NULL,
30 => NULL,
31 => NULL,
32 => NULL,
33 => NULL,
34 => NULL,
35 => NULL,
36 => NULL,
37 => NULL,
38 => NULL,
39 => NULL,
40 => NULL,
41 => NULL,
42 => NULL,
43 => NULL,
44 => NULL,
45 => NULL,
)
private string $lastError
private bool $encoded = true
public __construct(string $sid, bool $encoded = true): void
Parameter | Type | Description |
---|
$sid | string | |
$encoded | bool | |
public getLastError(): string
Checks that a protocol message type is valid and returns it's numeric value.
public check(string $type): int
Parameter | Type | Description |
---|
$type | string | If $type is a string, it is checked and if valid then it's numeric value is returned. If $type is an integer it will be returned back if valid. If either is not valid then false is returned. |
public getType(string $name): int
Parameter | Type | Description |
---|
$name | string | |
public getTypeName(mixed $type): string
Parameter | Type | Description |
---|
$type | mixed | |
public encode(string $type, mixed $payload): string
Parameter | Type | Description |
---|
$type | string | |
$payload | mixed | |
public decode(string $packet, mixed $payload, ?int $time): string
Parameter | Type | Description |
---|
$packet | string | |
$payload | mixed | |
$time | int | |
private error(string $msg): false
Parameter | Type | Description |
---|
$msg | string | |
Generated by Hazaar API Doc Generator