Skip to content

Commit

Permalink
Merge pull request #8 from hongcha98/fix-onmessage
Browse files Browse the repository at this point in the history
fix(onmessage): trigger
  • Loading branch information
a-wing authored Aug 6, 2023
2 parents 8adbd5b + 5537b50 commit 663a12d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,15 @@ func (c *Client) readPump() {
c.Err = err
break
}
c.worker.broadcast <- Message{
msg := Message{
Name: c.Name,
Room: c.Room,
Code: code,
Data: data,
conn: c.conn,
}
c.worker.server.onMessage(&msg)
c.worker.broadcast <- msg
}
}

Expand Down
1 change: 0 additions & 1 deletion worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func (w *worker) run(ctx context.Context) {
return
}
case message := <-w.broadcast:
w.server.onMessage(&message)
for client := range w.clients {
if w.server.config.Local || message.conn != client.conn {
select {
Expand Down

0 comments on commit 663a12d

Please sign in to comment.