Type Alias tokio_xmpp::starttls::StartTlsAsyncClient

source ·
pub type StartTlsAsyncClient = AsyncClient<ServerConfig>;
Expand description

AsyncClient that connects over StartTls

Aliased Type§

struct StartTlsAsyncClient { /* private fields */ }

Implementations

source§

impl<C: ServerConnector> Client<C>

source

pub fn new_with_config(config: Config<C>) -> Self

Start a new client given that the JID is already parsed.

source

pub fn set_reconnect(&mut self, reconnect: bool) -> &mut Self

Set whether to reconnect (true) or let the stream end (false) when a connection to the server has ended.

source

pub fn bound_jid(&self) -> Option<&Jid>

Get the client’s bound JID (the one reported by the XMPP server).

source

pub async fn send_stanza(&mut self, stanza: Element) -> Result<(), Error>

Send stanza

source

pub fn get_stream_features(&self) -> Option<&StreamFeatures>

Get the stream features (<stream:features/>) of the underlying stream

source

pub async fn send_end(&mut self) -> Result<(), Error>

End connection by sending </stream:stream>

You may expect the server to respond with the same. This client will then drop its connection.

Make sure to disable reconnect.

source§

impl AsyncClient<ServerConfig>

source

pub fn new<J: Into<Jid>, P: Into<String>>(jid: J, password: P) -> Self

Start a new XMPP client

Start polling the returned instance so that it will connect and yield events.

Trait Implementations

source§

impl<C: ServerConnector> Sink<Packet> for Client<C>

Outgoing XMPP packets

See send_stanza() for an async fn

§

type Error = Error

The type of value produced by the sink when an error occurs.
source§

fn start_send(self: Pin<&mut Self>, item: Packet) -> Result<(), Self::Error>

Begin the process of sending a value to the sink. Each call to this function must be preceded by a successful call to poll_ready which returned Poll::Ready(Ok(())). Read more
source§

fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>

Attempts to prepare the Sink to receive a value. Read more
source§

fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>

Flush any remaining output from this sink. Read more
source§

fn poll_close( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Result<(), Self::Error>>

Flush any remaining output and close this sink, if necessary. Read more
source§

impl<C: ServerConnector> Stream for Client<C>

Incoming XMPP events

In an async fn you may want to use this with use futures::stream::StreamExt;

source§

fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<Option<Self::Item>>

Low-level read on the XMPP stream, allowing the underlying machinery to:

  • connect,
  • starttls,
  • authenticate,
  • bind a session, and finally
  • receive stanzas

…for your client

§

type Item = Event

Values yielded by the stream.
source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more