first commit

This commit is contained in:
Adrian Zürcher
2026-01-16 07:51:28 +01:00
commit 4d9e0836e5
15 changed files with 764 additions and 0 deletions

23
handlers/websocket.go Normal file
View File

@@ -0,0 +1,23 @@
package handlers
import (
"net/http"
"github.com/gorilla/websocket"
)
var (
upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool { return true },
}
)
func Websocket(w http.ResponseWriter, r *http.Request) {
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {
return
}
clientsMu.Lock()
clients[conn] = true
clientsMu.Unlock()
}