Skip to content

Commit

Permalink
feat: LinkTx::unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
de-sh committed Jul 30, 2024
1 parent db1f261 commit 9686992
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rumqttd/src/link/local.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::protocol::{
Filter, LastWill, LastWillProperties, Packet, Publish, QoS, RetainForwardRule, Subscribe,
Unsubscribe,
};
use crate::router::Ack;
use crate::router::{
Expand Down Expand Up @@ -281,6 +282,17 @@ impl LinkTx {
Ok(len)
}

/// Sends a MQTT Unsubscribe to the eventloop
pub fn unsubscribe<S: Into<String>>(&mut self, filter: S) -> Result<usize, LinkError> {
let unsubscribe = Unsubscribe {
pkid: 0,
filters: vec![filter.into()],
};

let len = self.push(Packet::Unsubscribe(unsubscribe, None))?;
Ok(len)
}

/// Request to get device shadow
pub fn shadow<S: Into<String>>(&mut self, filter: S) -> Result<(), LinkError> {
let message = Event::Shadow(ShadowRequest {
Expand Down

0 comments on commit 9686992

Please sign in to comment.