Created
September 6, 2022 06:16
-
-
Save percybolmer/56d50a81cad0454cc88c0b41e8c58dfd to your computer and use it in GitHub Desktop.
Websocket clients
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
package main | |
import "github.com/gorilla/websocket" | |
// ClientList is a map used to help manage a map of clients | |
type ClientList map[*Client]bool | |
// 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 | |
} | |
// 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, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment