@@ 111-123 (lines=13) @@ | ||
108 | * |
|
109 | * @return PromiseAdapter |
|
110 | */ |
|
111 | public function subscribe($topicName, callable $callback, $options = null) |
|
112 | { |
|
113 | $this->on($topicName, $callback); |
|
114 | ||
115 | $this->subscriptions[$topicName] = static::createDeferredAdapter(); |
|
116 | $this->subscribing[$topicName] = new SubscribeMessage( |
|
117 | count($this->subscriptions), |
|
118 | (object) $options, |
|
119 | $topicName |
|
120 | ); |
|
121 | ||
122 | return $this->subscriptions[$topicName]->promise(); |
|
123 | } |
|
124 | ||
125 | /** |
|
126 | * Trigger a SUBSCRIBED message for given topic. |
|
@@ 223-235 (lines=13) @@ | ||
220 | * |
|
221 | * @return PromiseAdapter |
|
222 | */ |
|
223 | public function register($procedureName, callable $callback, $options = null) |
|
224 | { |
|
225 | $this->procedures[$procedureName] = $callback; |
|
226 | ||
227 | $this->registrations[$procedureName] = static::createDeferredAdapter(); |
|
228 | $this->registering[$procedureName] = new RegisterMessage( |
|
229 | count($this->registering), |
|
230 | $options, |
|
231 | $procedureName |
|
232 | ); |
|
233 | ||
234 | return $this->registrations[$procedureName]->promise(); |
|
235 | } |
|
236 | ||
237 | /** |
|
238 | * Trigger a REGISTERED message for given procedure. |