All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 3m25s
23 lines
354 B
Go
23 lines
354 B
Go
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)
|
|
}
|