1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* IClient.php |
4
|
|
|
* |
5
|
|
|
* @copyright More in license.md |
6
|
|
|
* @license https://www.ipublikuj.eu |
7
|
|
|
* @author Adam Kadlec <[email protected]> |
8
|
|
|
* @package iPublikuj:WebSocketsWAMPClient! |
9
|
|
|
* @subpackage Client |
10
|
|
|
* @since 1.0.0 |
11
|
|
|
* |
12
|
|
|
* @date 11.05.18 |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
declare(strict_types = 1); |
16
|
|
|
|
17
|
|
|
namespace IPub\WebSocketsWAMPClient\Client; |
18
|
|
|
|
19
|
|
|
use React\EventLoop; |
20
|
|
|
|
21
|
|
|
use IPub\WebSocketsWAMPClient\Exceptions; |
22
|
|
|
|
23
|
1 |
|
interface IClient |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Connect client to server |
27
|
|
|
* |
28
|
|
|
* @return void |
29
|
|
|
* |
30
|
|
|
* @throws Exceptions\ConnectionException |
31
|
|
|
*/ |
32
|
|
|
public function connect() : void; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Disconnect from server |
36
|
|
|
* |
37
|
|
|
* @return void |
38
|
|
|
*/ |
39
|
|
|
public function disconnect() : void; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return bool |
43
|
|
|
*/ |
44
|
|
|
public function isConnected() : bool; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param string $topicUri |
48
|
|
|
* @param string $event |
49
|
|
|
* @param array $exclude |
50
|
|
|
* @param array $eligible |
51
|
|
|
* |
52
|
|
|
* @return void |
53
|
|
|
*/ |
54
|
|
|
public function publish(string $topicUri, string $event, array $exclude = [], array $eligible = []) : void; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @param string $topicUri |
58
|
|
|
* |
59
|
|
|
* @return void |
60
|
|
|
*/ |
61
|
|
|
public function subscribe(string $topicUri) : void; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param string $topicUri |
65
|
|
|
* |
66
|
|
|
* @return void |
67
|
|
|
*/ |
68
|
|
|
public function unsubscribe(string $topicUri) : void; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param string $processUri |
72
|
|
|
* @param array $args |
73
|
|
|
* @param callable $successCallback |
74
|
|
|
* @param callable $errorCallback |
75
|
|
|
* |
76
|
|
|
* @return void |
77
|
|
|
*/ |
78
|
|
|
public function call(string $processUri, array $args, callable $successCallback = NULL, callable $errorCallback = NULL) : void; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @param EventLoop\LoopInterface $loop |
82
|
|
|
* |
83
|
|
|
* @return void |
84
|
|
|
*/ |
85
|
|
|
public function setLoop(EventLoop\LoopInterface $loop) : void; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @return EventLoop\LoopInterface |
89
|
|
|
*/ |
90
|
|
|
public function getLoop() : EventLoop\LoopInterface; |
91
|
|
|
} |
92
|
|
|
|