Skip to content

Commit

Permalink
add client.Send to send a ws event to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
cpoile committed Jan 25, 2024
1 parent e6976e3 commit d815c24
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ func (c *Client) On(eventType EventType, h EventHandler) {
c.handlers[eventType] = h
}

// Send sends a websocket event to the server
func (c *Client) Send(ev string, msg any, binary bool) error {
return c.wsSend(ev, msg, binary)
}

func (c *Client) emit(eventType EventType, ctx any) {
c.mut.RLock()
handler := c.handlers[eventType]
Expand Down

0 comments on commit d815c24

Please sign in to comment.