protected function subscribeAtPubnub() { if (!$this->isSubscribed()) { return $this; } $this->pubnub = $this->context->getPubnub(array('publish_key' => 'foo', 'subscribe_key' => $this->subscription['deliveryMode']['subscriberKey'])); //print 'PUBNUB object created' . PHP_EOL; $this->pubnub->subscribe($this->subscription['deliveryMode']['address'], array($this, 'notify')); //print 'PUBNUB subscription created' . PHP_EOL; return $this; }