Move where the message type is set, and standardize on all caps CHAT

This commit is contained in:
Gabe Kangas
2020-06-24 23:20:19 -07:00
parent 8878ca1e88
commit 4132cf6d09
2 changed files with 7 additions and 7 deletions

View File

@@ -77,7 +77,6 @@ func (c *Client) listenWrite() {
websocket.JSON.Send(c.ws, msg)
// send message to the client
case msg := <-c.ch:
msg.MessageType = "CHAT"
// log.Println("Send:", msg)
websocket.JSON.Send(c.ws, msg)
@@ -110,6 +109,7 @@ func (c *Client) listenRead() {
}
msg.ID = id
msg.MessageType = "CHAT"
if err := websocket.JSON.Receive(c.ws, &msg); err == io.EOF {
c.doneCh <- true