pub struct StreamingClient { /* private fields */ }Expand description
Client for connecting to Mastodon’s real-time streaming API via WebSockets.
Implementations§
Source§impl StreamingClient
impl StreamingClient
pub fn new(base_url: &str, access_token: Option<String>) -> Self
Sourcepub async fn subscribe(
&self,
stream_type: &str,
) -> Result<Pin<Box<dyn Stream<Item = Result<MastodonEvent>> + Send>>>
pub async fn subscribe( &self, stream_type: &str, ) -> Result<Pin<Box<dyn Stream<Item = Result<MastodonEvent>> + Send>>>
Subscribes to a specific stream type.
§Common Stream Types
user: Events related to the authenticated user.public: All public statuses.direct: Direct messages/conversations.hashtag: Statuses containing a specific tag.
Returns a pinned stream of MastodonEvents.
Auto Trait Implementations§
impl Freeze for StreamingClient
impl RefUnwindSafe for StreamingClient
impl Send for StreamingClient
impl Sync for StreamingClient
impl Unpin for StreamingClient
impl UnwindSafe for StreamingClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more