Skip to content

Commit 5131e67

Browse files
author
Devdutt Shenoi
committed
feat: LinkTx::try_unsubscribe
1 parent 9686992 commit 5131e67

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

rumqttd/src/link/local.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,17 @@ impl LinkTx {
293293
Ok(len)
294294
}
295295

296+
/// Sends a MQTT Unsubscribe to the eventloop
297+
pub fn try_unsubscribe<S: Into<String>>(&mut self, filter: S) -> Result<usize, LinkError> {
298+
let unsubscribe = Unsubscribe {
299+
pkid: 0,
300+
filters: vec![filter.into()],
301+
};
302+
303+
let len = self.try_push(Packet::Unsubscribe(unsubscribe, None))?;
304+
Ok(len)
305+
}
306+
296307
/// Request to get device shadow
297308
pub fn shadow<S: Into<String>>(&mut self, filter: S) -> Result<(), LinkError> {
298309
let message = Event::Shadow(ShadowRequest {

0 commit comments

Comments
 (0)