Skip to content

Commit 25114b1

Browse files
committed
Upgrade to binsoul/net-mqtt version 0.7
1 parent 1c58aa8 commit 25114b1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
],
1919
"require": {
2020
"php": "^7.2",
21-
"binsoul/net-mqtt": "^0.6",
21+
"binsoul/net-mqtt": "^0.7",
2222
"evenement/evenement": "^3",
2323
"react/event-loop": "^1.1",
2424
"react/promise": "^2.7",

src/ReactMqttClient.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,17 @@ public function unsubscribe(Subscription $subscription): ExtendedPromiseInterfac
325325
return new RejectedPromise(new LogicException('The client is not connected.'));
326326
}
327327

328-
return $this->startFlow($this->flowFactory->buildOutgoingUnsubscribeFlow([$subscription]));
328+
$deferred = new Deferred();
329+
330+
$this->startFlow($this->flowFactory->buildOutgoingUnsubscribeFlow([$subscription]))
331+
->then(static function (array $subscriptions) use ($deferred) {
332+
$deferred->resolve(array_shift($subscriptions));
333+
})
334+
->otherwise(static function ($exception) use ($deferred) {
335+
$deferred->reject($exception);
336+
});
337+
338+
return $deferred->promise();
329339
}
330340

331341
/**

0 commit comments

Comments
 (0)