pub struct CoapTransport { /* private fields */ }Expand description
Implementations§
Source§impl CoapTransport
impl CoapTransport
Sourcepub fn new(config: CoapConfig) -> Self
pub fn new(config: CoapConfig) -> Self
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Reports whether the transport currently holds a bound socket.
§Returns
true once connect has succeeded and before
disconnect is called.
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Trait Implementations§
Source§impl Transport for CoapTransport
impl Transport for CoapTransport
Source§async fn subscribe(&mut self, topic: &str) -> Result<()>
async fn subscribe(&mut self, topic: &str) -> Result<()>
Registers an observation of a resource path, so its notifications arrive.
A notification carries no path of its own, only the token of the request that registered it (RFC 7641 section 3.2), so the client remembers which path each token observes and delivers every notification under that path. Registering a path again reuses its token, which a server takes as renewing the observation rather than adding a second one (RFC 7641 section 4.1), so a node can register again now and then in case the server has restarted.
§Returns
Ok(()) once the server has registered the observation, or has acknowledged
the request with its response to follow.
§Errors
Returns [Error::Transport] if the server refuses the request, answers it
without registering an observation, or never acknowledges it, and
[Error::Closed] if the transport is not connected.