Skip to content

Commit

Permalink
feat(socketio): add broadcast operator on io struct (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
Totodore authored Dec 19, 2024
1 parent 9a58244 commit cb30a86
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/socketioxide/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,13 @@ impl<A: Adapter> SocketIo<A> {
self.get_default_op().get_socket(sid)
}

/// _Alias for `io.of("/").unwrap().broadcast()`_. If the **default namespace "/" is not found** this fn will panic!
#[doc = include_str!("../docs/operators/broadcast.md")]
#[inline]
pub fn broadcast(&self) -> BroadcastOperators<A> {
self.get_default_op().broadcast()
}

#[cfg(feature = "state")]
pub(crate) fn get_state<T: Clone + 'static>(&self) -> Option<T> {
self.0.state.try_get::<T>().cloned()
Expand Down

0 comments on commit cb30a86

Please sign in to comment.