1 | <?php |
||
24 | trait MonitorTrait |
||
25 | { |
||
26 | use EventEmitterTrait; |
||
27 | |||
28 | /** |
||
29 | * The monitor's WAMP client session. |
||
30 | * |
||
31 | * @var ClientSession |
||
32 | */ |
||
33 | protected $session; |
||
34 | |||
35 | /** |
||
36 | * if the monitor is running. |
||
37 | * |
||
38 | * @var bool |
||
39 | */ |
||
40 | protected $isRunning = false; |
||
41 | |||
42 | /** |
||
43 | * @var SubscriptionCollection collection for meta subscriptions |
||
44 | */ |
||
45 | protected $metaSubscriptionCollection; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $initialCallProcedure; |
||
51 | |||
52 | /** |
||
53 | * @var callable |
||
54 | */ |
||
55 | protected $initialCallCallback; |
||
56 | |||
57 | /** |
||
58 | * @var bool |
||
59 | */ |
||
60 | protected $initialCallDone = false; |
||
61 | |||
62 | /** |
||
63 | * @param ClientSession $session |
||
64 | */ |
||
65 | protected function setClientSession(ClientSession $session) |
||
69 | |||
70 | /** |
||
71 | * Start the monitor. |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function start() |
||
86 | |||
87 | /** |
||
88 | * Stop the monitor. |
||
89 | * Returns boolean if the monitor could be started. |
||
90 | * |
||
91 | * @return bool |
||
92 | */ |
||
93 | public function stop() |
||
106 | |||
107 | protected function getList() |
||
111 | |||
112 | /** |
||
113 | * Get the monitor's WAMP client session. |
||
114 | * |
||
115 | * @return ClientSession |
||
116 | */ |
||
117 | public function getServerSession() |
||
121 | |||
122 | /** |
||
123 | * Get the monitor's running state. |
||
124 | * |
||
125 | * @return bool |
||
126 | */ |
||
127 | public function isRunning() |
||
131 | |||
132 | /** |
||
133 | * @param \Tidal\WampWatch\Subscription\Collection $collection |
||
134 | */ |
||
135 | public function setMetaSubscriptionCollection(SubscriptionCollection $collection) |
||
139 | |||
140 | /** |
||
141 | * @return \Tidal\WampWatch\Subscription\Collection |
||
142 | */ |
||
143 | public function getMetaSubscriptionCollection() |
||
149 | |||
150 | protected function setInitialCall($pocedure, callable $callback) |
||
155 | |||
156 | /** |
||
157 | * @return \React\Promise\Promise |
||
158 | */ |
||
159 | protected function callInitialProcedure() |
||
178 | |||
179 | /** |
||
180 | * Checks if all necessary subscriptions and calls have been responded to. |
||
181 | */ |
||
182 | protected function checkStarted() |
||
192 | |||
193 | protected function isMetaSubscribed() |
||
201 | } |
||
202 |