public function __construct(Client $client) { $this->client = $client; $self = $this; $client->connect()->then(function () use($self) { $self->applySubscriptions(); }); }
private function getConnectedClient(InputStreamInterface $input, OutputStreamInterface $output) { $client = new Client($input, $output, array('vhost' => 'localhost')); $client->connect(); $input->emit('frame', array(new Frame('CONNECTED'))); return $client; }