pub struct SocketIO { /* private fields */ }
Implementations§
Source§impl 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§
Auto Trait Implementations§
impl Freeze for SocketIOSocket
impl !RefUnwindSafe for SocketIOSocket
impl Send for SocketIOSocket
impl Sync for SocketIOSocket
impl Unpin for SocketIOSocket
impl !UnwindSafe for SocketIOSocket
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