Created
September 7, 2022 13:24
-
-
Save percybolmer/c18a5559a742e1c7c8587e3a69287f44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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