/** * @covers PusherClient */ public function testUserAgentIsIncluded() { // Make sure the user agent contains "pusher-php" $command = $this->client->getCommand('GetChannelsInfo'); $request = $command->prepare(); $this->client->dispatch('command.before_send', array('command' => $command)); $this->assertRegExp('/^zfr-pusher-php/', (string) $request->getHeader('User-Agent', true)); }
/** * Authenticate a user (identified by its socket identifier) to a private channel. This method returns * an array whose key is "auth" and value is the signature. It's up to the user to return this correctly * into a JSON string (typically in a controller) * * @link http://pusher.com/docs/auth_signatures#worked-example * @param string $channel * @param string $socketId * @return array */ public function authenticatePrivate($channel, $socketId) { $credentials = $this->client->getCredentials(); $signature = $this->client->getSignature(); return $signature->signPrivateChannel($channel, $socketId, $credentials); }