Skip to content

Commit

Permalink
feat: topic check before executing handle
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhnajafiz committed Aug 11, 2022
1 parent 5e282a0 commit cdf4828
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ func (c *client) listen() {

// handle will execute the topic handler method.
func (c *client) handle(m message) {
c.topics[m.Topic](m.Data)
if handler, ok := c.topics[m.Topic]; ok {
handler(m.Data)
}
}

// close will terminate everything.
Expand Down

0 comments on commit cdf4828

Please sign in to comment.