-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectionInterface.php
48 lines (42 loc) · 1.09 KB
/
ConnectionInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* RTCKit\ESL\ConnectionInterface Interface
*/
declare(strict_types = 1);
namespace RTCKit\ESL;
/**
* ESL connection interface
*/
interface ConnectionInterface
{
/* ConnectionInterface::consume() return values */
public const READY = 0;
public const WAIT_MESSAGE = 1;
public const WAIT_BODY = 2;
public const SUCCESS = 3;
/* https://github.com/rtckit/php-esl#esl-connection */
public const INBOUND_CLIENT = 1;
public const OUTBOUND_SERVER = 2;
public const INBOUND_SERVER = 3;
public const OUTBOUND_CLIENT = 4;
/**
* Constructs a new connection
*
* @param int $role
*/
public function __construct(int $role);
/**
* Consumes incoming ESL traffic (raw bytes)
*
* @param string $chunk
* @param list<MessageInterface> $messages
* @return int
*/
public function consume(string $chunk, ?array &$messages = []): int;
/**
* Initiates the sending of an outgoing ESL message
*
* @param MessageInterface $message
*/
public function emit(MessageInterface $message): void;
}