Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created September 7, 2022 13:24
Show Gist options
  • Save percybolmer/c18a5559a742e1c7c8587e3a69287f44 to your computer and use it in GitHub Desktop.
Save percybolmer/c18a5559a742e1c7c8587e3a69287f44 to your computer and use it in GitHub Desktop.
// Client is a websocket client, basically a frontend visitor
type Client struct {
// the websocket connection
connection *websocket.Conn
// manager is the manager used to manage the client
manager *Manager
// egress is used to avoid concurrent writes on the WebSocket
egress chan []byte
}
// NewClient is used to initialize a new Client with all required values initialized
func NewClient(conn *websocket.Conn, manager *Manager) *Client {
return &Client{
connection: conn,
manager: manager,
egress: make(chan []byte),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment