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