Example #1
0
 /**
  * Sets the callback used to notify the client after a connection error.
  *
  * @param ConnectionInterface $connection Connection instance.
  * @param mixed $callback Callback for error event.
  */
 protected function setErrorCallback(ConnectionInterface $connection, $callback)
 {
     $client = $this;
     $connection->setErrorCallback(function ($connection, $exception) use($callback, $client) {
         call_user_func($callback, $client, $exception, $connection);
     });
 }