Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Created September 6, 2022 06:16
Show Gist options
  • Save percybolmer/56d50a81cad0454cc88c0b41e8c58dfd to your computer and use it in GitHub Desktop.
Save percybolmer/56d50a81cad0454cc88c0b41e8c58dfd to your computer and use it in GitHub Desktop.
Websocket clients
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