1 | <?php |
||
24 | class Room |
||
25 | { |
||
26 | /** |
||
27 | * @param $roomId |
||
28 | * @return mixed |
||
29 | */ |
||
30 | public static function getId($roomId) |
||
41 | |||
42 | /** |
||
43 | * @var Client |
||
44 | */ |
||
45 | protected $client; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | public $id; |
||
51 | |||
52 | /** |
||
53 | * @var Middlewares |
||
54 | */ |
||
55 | protected $middlewares; |
||
56 | |||
57 | /** |
||
58 | * Room constructor. |
||
59 | * @param string $roomId |
||
60 | */ |
||
61 | public function __construct($roomId) |
||
69 | |||
70 | /** |
||
71 | * Create subscribers storage |
||
72 | * @return Subscribers |
||
73 | */ |
||
74 | protected function createSubscribersStorage() |
||
87 | |||
88 | /** |
||
89 | * Create middlewares storage |
||
90 | * @return Middlewares |
||
91 | */ |
||
92 | protected function createMiddlewaresStorage() |
||
105 | |||
106 | /** |
||
107 | * @throws InvalidArgumentException |
||
108 | * @return Client |
||
109 | */ |
||
110 | public function listen() |
||
122 | |||
123 | /** |
||
124 | * @param \Exception $e |
||
125 | */ |
||
126 | protected function logException(\Exception $e) |
||
134 | |||
135 | /** |
||
136 | * @param Message $message |
||
137 | */ |
||
138 | public function onMessage(Message $message) |
||
146 | |||
147 | /** |
||
148 | * @TODO I do not know if it works |
||
149 | * @param Stream $stream |
||
150 | */ |
||
151 | public function onClose(Stream $stream) |
||
155 | |||
156 | /** |
||
157 | * @param Stream $stream |
||
158 | * @param \Exception $e |
||
159 | */ |
||
160 | public function onError(Stream $stream, \Exception $e) |
||
164 | |||
165 | /** |
||
166 | * @param $text |
||
167 | * @return $this |
||
168 | */ |
||
169 | public function write($text) |
||
181 | } |
||
182 |