@@ 277-286 (lines=10) @@ | ||
274 | * @callback $onResponse ( ) |
|
275 | * @return boolean Success |
|
276 | */ |
|
277 | public function requestByServer($server, $data, $onResponse = null) |
|
278 | { |
|
279 | $this->getConnection($server, function ($conn) use ($data, $onResponse) { |
|
280 | if (!$conn->isConnected()) { |
|
281 | return; |
|
282 | } |
|
283 | $conn->onResponse($onResponse); |
|
284 | $conn->write($data); |
|
285 | }); |
|
286 | return true; |
|
287 | } |
|
288 | ||
289 | /** |
|
@@ 297-306 (lines=10) @@ | ||
294 | * @callback $onResponse ( ) |
|
295 | * @return boolean Success |
|
296 | */ |
|
297 | public function requestByKey($key, $data, $onResponse = null) |
|
298 | { |
|
299 | $this->getConnectionByKey($key, function ($conn) use ($data, $onResponse) { |
|
300 | if (!$conn->isConnected()) { |
|
301 | return; |
|
302 | } |
|
303 | $conn->onResponse($onResponse); |
|
304 | $conn->write($data); |
|
305 | }); |
|
306 | return true; |
|
307 | } |
|
308 | ||
309 | /** |