Files
edas/client.go
T

26 lines
388 B
Go

package main
import "github.com/gorilla/websocket"
type Client struct {
hub *Hub
conn *websocket.Conn
}
func (c *Client) close() {
c.hub.unregisterClient(c)
_ = c.conn.Close()
}
// keepAlive This keeps the connection alive until a disconnect happens.
func (c *Client) keepAlive() {
defer c.close()
for {
_, _, err := c.conn.ReadMessage()
if err != nil {
break
}
}
}