コード例 #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);
 }
コード例 #2
0
ファイル: Connector.php プロジェクト: Lstt2005/phpMqttClient
 /**
  * @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();
 }