Esempio n. 1
0
 public function testPublishStandard()
 {
     $version = new \oliverlorenz\reactphpmqtt\protocol\Version4();
     $packet = new \oliverlorenz\reactphpmqtt\packet\Unsubscribe($version);
     $this->assertEquals(\oliverlorenz\reactphpmqtt\packet\Unsubscribe::getControlPacketType(), 10);
 }
Esempio n. 2
0
 /**
  * @param string $topic
  */
 public function unsubscribe(Stream $stream, $topic)
 {
     $packet = new Unsubscribe($this->version);
     $packet->removeSubscription($topic);
     $this->sentMessageToStream($stream, $packet);
     $deferred = new Deferred();
     $stream->on('UNSUBSCRIBE_ACK', function ($message) use($stream, $deferred) {
         $deferred->resolve($stream);
     });
     return $deferred->promise();
 }