tokio_xmpp::connect::tcp

Type Alias TcpClient

Source
pub type TcpClient = Client;
👎Deprecated since 5.0.0: use tokio_xmpp::Client instead
Available on crate feature insecure-tcp only.
Expand description

Client that connects over TCP

Aliased Type§

struct TcpClient { /* private fields */ }

Implementations

Source§

impl Client

Source

pub fn new_plaintext<J: Into<Jid>, P: Into<String>>( jid: J, password: P, dns_config: DnsConfig, timeouts: Timeouts, ) -> Self

Start a new XMPP client with plaintext insecure connection and specific DNS config

Source§

impl Client

Source

pub fn new_with_connector<J: Into<Jid>, P: Into<String>, C: ServerConnector>( jid: J, password: P, connector: C, timeouts: Timeouts, ) -> Self

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

Source§

impl Client

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: Stanza, ) -> Result<StanzaToken, 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(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.

Source§

impl Client

Source

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

Available on crate feature starttls only.

Start a new XMPP client using StartTLS transport and autoreconnect

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

Source

pub fn new_starttls<J: Into<Jid>, P: Into<String>>( jid: J, password: P, dns_config: DnsConfig, timeouts: Timeouts, ) -> Self

Available on crate feature starttls only.

Start a new XMPP client with StartTLS transport and specific DNS config

Trait Implementations

Source§

impl Stream for Client

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

Source§

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