22 lines
467 B
Go
22 lines
467 B
Go
package server
|
|
|
|
// Client represents a single WebSocket connection and associated user state.
|
|
// It includes a send channel for outbound messages and LastPong for liveness.
|
|
import (
|
|
"sync"
|
|
"time"
|
|
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
// Client holds the websocket connection and linkage back to the Hub.
|
|
type Client struct {
|
|
Conn *websocket.Conn
|
|
Username string
|
|
Id string
|
|
Hub *Hub
|
|
Mu sync.RWMutex
|
|
LastPong time.Time
|
|
Send chan []byte
|
|
}
|