Thruway\ClientSession::subscribe PHP Method

subscribe() public method

Subscribe
public subscribe ( string $topicName, callable $callback, $options = null ) : Promise
$topicName string
$callback callable
$options array
return React\Promise\Promise
    public function subscribe($topicName, callable $callback, $options = null)
    {
        return $this->peer->getSubscriber()->subscribe($this, $topicName, $callback, $options);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param \Thruway\ClientSession $session
  * @param \Thruway\Transport\TransportInterface $transport
  */
 public function onSessionStart($session, $transport)
 {
     // TODO: now that the session has started, setup the stuff
     echo "--------------- Hello from InternalClient ------------\n";
     $session->register('com.example.getphpversion', [$this, 'getPhpVersion']);
     $session->register('com.example.getonline', [$this, 'getOnline']);
     $session->subscribe('wamp.metaevent.session.on_join', [$this, 'onSessionJoin']);
     $session->subscribe('wamp.metaevent.session.on_leave', [$this, 'onSessionLeave']);
 }
All Usage Examples Of Thruway\ClientSession::subscribe