doc: add and improve comments
This commit is contained in:
parent
d83acc77b2
commit
d0b1260f62
12 changed files with 50 additions and 26 deletions
|
@ -13,12 +13,12 @@ import (
|
|||
var Clients = make(map[*websocket.Conn]*models.Client)
|
||||
var mu sync.Mutex // Mutex to protect access to the Clients map
|
||||
|
||||
// Upgrader to upgrade HTTP requests to WebSocket connections
|
||||
// Upgrade HTTP requests to WebSocket connections
|
||||
var upgrader = websocket.Upgrader{
|
||||
CheckOrigin: func(r *http.Request) bool { return true },
|
||||
}
|
||||
|
||||
// HandleConnection upgrades HTTP requests to WebSocket connections and manages the client lifecycle.
|
||||
// Upgrades HTTP requests to WebSocket connections and manages the client lifecycle
|
||||
func HandleConnection(w http.ResponseWriter, r *http.Request) {
|
||||
// Upgrade initial GET request to a WebSocket
|
||||
ws, err := upgrader.Upgrade(w, r, nil)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue