Only send hello message to non-JSON clients

This commit is contained in:
Trevor Slocum 2023-10-26 15:02:32 -07:00
parent e62a9053a3
commit 764def5eea
2 changed files with 4 additions and 1 deletions

View file

@ -100,7 +100,7 @@ func (c *webSocketClient) writeEvents(closeWrite chan struct{}) {
setTimeout()
var event []byte
for event = range c.events {
for {
select {
case <-closeWrite:
for {

View file

@ -272,6 +272,9 @@ func (s *server) randomUsername() []byte {
}
func (s *server) sendHello(c *serverClient) {
if c.json {
return
}
c.Write(s.welcome)
}