[][src]Struct misskey::websocket::WebSocketClient

pub struct WebSocketClient { /* fields omitted */ }
This is supported on crate feature websocket-client only.

Asynchronous WebSocket-based client for Misskey.

WebSocketClient can be constructed using WebSocketClient::connect or WebSocketClientBuilder. The latter is more flexible and intuitive.

You do not have to wrap this in Arc and Mutex to share it because WebSocketClient is already Clone and every methods of WebSocketClient takes &self, i.e. they does not require mutability.

Implementations

impl WebSocketClient[src]

pub async fn connect(url: Url) -> Result<WebSocketClient, Error>[src]

Connects to Misskey using WebSocket, and returns WebSocketClient.

pub async fn connect_with_config(
    url: Url,
    reconnect_config: ReconnectConfig
) -> Result<WebSocketClient, Error>
[src]

Connects to Misskey using WebSocket with a given reconnect configuration, and returns WebSocketClient.

pub fn builder<T>(url: T) -> WebSocketClientBuilder where
    T: TryInto<Url>,
    <T as TryInto<Url>>::Error: Into<Error>, 
[src]

Creates a new builder instance with url. All configurations are set to default.

This function is identical to WebSocketClientBuilder::new.

pub fn subnote<E, Id>(
    &self,
    note_id: Id
) -> Pin<Box<dyn Future<Output = Result<SubNote<E>, Error>> + 'static + Send, Global>> where
    E: SubNoteEvent,
    Id: Into<String>, 
[src]

Captures the note specified by id.

The returned SubNote implements Stream so that note events can be retrieved asynchronously via it.

pub fn channel<R>(
    &self,
    request: R
) -> Pin<Box<dyn Future<Output = Result<Channel<<R as ConnectChannelRequest>::Incoming, <R as ConnectChannelRequest>::Outgoing>, Error>> + 'static + Send, Global>> where
    R: ConnectChannelRequest
[src]

Connects to the channel using request.

The returned Channel implements Stream and Sink so that you can exchange messages with channels on it.

pub fn broadcast<E>(
    &self
) -> Pin<Box<dyn Future<Output = Result<Broadcast<E>, Error>> + 'static + Send, Global>> where
    E: BroadcastEvent
[src]

Receive messages from the broadcast stream.

The returned Broadcast implements Stream so that broadcast events can be retrieved asynchronously via it.

Trait Implementations

impl Client for WebSocketClient[src]

type Error = Error

The error type produced by the client when an error occurs.

impl Clone for WebSocketClient[src]

impl Debug for WebSocketClient[src]

impl StreamingClient for WebSocketClient[src]

type Error = Error

The error type produced by the client when an error occurs.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<C> ClientExt for C where
    C: Sync + Client
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<C> StreamingClientExt for C where
    C: Sync + StreamingClient
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]