Skip to content

Commit

Permalink
fix: resolve issue where socket.Server.Emit fails to broadcast data…
Browse files Browse the repository at this point in the history
… to the root namespace

- Fixes #71.
  • Loading branch information
zishang520 committed Oct 24, 2024
1 parent 7d02ab0 commit 2e07b24
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions socket/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,15 @@ func (s *Server) Except(room ...Room) *BroadcastOperator {
return s.sockets.Except(room...)
}

// Emits to all clients.
//
// // the “foo” event will be broadcast to all connected clients
// io.Emit("foo", "bar")
func (s *Server) Emit(ev string, args ...any) *Server {
s.sockets.Emit(ev, args...)
return s
}

// Sends a `message` event to all clients.
//
// This method mimics the WebSocket.send() method.
Expand Down

0 comments on commit 2e07b24

Please sign in to comment.