Centralize chan closure to be done in the client, not the server. Set chan size to max message size.

This commit is contained in:
Gabe Kangas
2021-07-22 15:27:12 -07:00
parent f782e82909
commit c3e8e78dad
2 changed files with 9 additions and 4 deletions
+7 -1
View File
@@ -156,6 +156,10 @@ func (c *ChatClient) close() {
c.conn.Close()
c.server.unregister <- c
if c.send != nil {
close(c.send)
c.send = nil
}
}
func (c *ChatClient) passesRateLimit() bool {
@@ -175,7 +179,9 @@ func (c *ChatClient) sendPayload(payload events.EventPayload) {
return
}
c.send <- data
if c.send != nil {
c.send <- data
}
}
func (c *ChatClient) sendAction(message string) {