Struct thruster_socketio::SocketIO
source · [−]pub struct SocketIO { /* private fields */ }
Implementations
sourceimpl SocketIOSocket
impl SocketIOSocket
pub fn new(id: String, sender: Sender<InternalMessage>) -> Self
sourcepub fn use_handler(
&self,
_handler: fn(_: SocketIOSocket, _: String) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send>>
)
pub fn use_handler(
&self,
_handler: fn(_: SocketIOSocket, _: String) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send>>
)
use_handler isn’t implemented yet.
sourcepub fn on(
&mut self,
event: &str,
handler: fn(_: SocketIOSocket, _: String) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send>>
)
pub fn on(
&mut self,
event: &str,
handler: fn(_: SocketIOSocket, _: String) -> Pin<Box<dyn Future<Output = Result<(), ()>> + Send>>
)
on adds a listener for a particular event
sourcepub async fn join(&mut self, room_id: &str)
pub async fn join(&mut self, room_id: &str)
join joins a socket into a room. This makes every message sent by that socket go to the room rather than globally.
sourcepub async fn leave(&mut self, room_id: &str)
pub async fn leave(&mut self, room_id: &str)
leave removes a socket from a room. Note that you cannot remove a socket from its default room, i.e. its SID. This will result in a noop.
sourcepub async fn emit_to(&self, room_id: &str, event: &str, message: &str)
pub async fn emit_to(&self, room_id: &str, event: &str, message: &str)
emit_to sends a message to all sockets connected to the given room_id, including the sending socket.
sourcepub async fn broadcast_to(&self, room_id: &str, event: &str, message: &str)
pub async fn broadcast_to(&self, room_id: &str, event: &str, message: &str)
broadcast_to sends a message to all the sockets connected to the given room_id, excluding the sending socket.
Trait Implementations
sourceimpl Clone for SocketIOSocket
impl Clone for SocketIOSocket
Auto Trait Implementations
impl !RefUnwindSafe for SocketIOSocket
impl Send for SocketIOSocket
impl Sync for SocketIOSocket
impl Unpin for SocketIOSocket
impl !UnwindSafe for SocketIOSocket
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more