Skip to content

Commit

Permalink
feat: LinkTx::try_unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
Devdutt Shenoi committed Jul 30, 2024
1 parent 9686992 commit 5131e67
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rumqttd/src/link/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,17 @@ impl LinkTx {
Ok(len)
}

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

let len = self.try_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 5131e67

Please sign in to comment.