new server

This commit is contained in:
Smile Rex
2026-01-14 23:10:23 +03:00
parent 83f356cea9
commit c1df49fde1
12 changed files with 342 additions and 69 deletions

22
controllers/ws.go Normal file
View File

@@ -0,0 +1,22 @@
package controllers
import (
"log"
"net/http"
"github.com/gorilla/websocket"
)
func (h *Hub) ws(w http.ResponseWriter, r *http.Request) {
upgrader := websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool { return true },
}
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {
log.Println(err)
return
}
go h.readLoop(conn)
}