mirror of
https://github.com/Alexander-D-Karpov/about.git
synced 2026-03-16 22:06:08 +03:00
22 lines
358 B
Go
22 lines
358 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/Alexander-D-Karpov/about/internal/stream"
|
|
)
|
|
|
|
type WebSocketHandler struct {
|
|
hub *stream.Hub
|
|
}
|
|
|
|
func NewWebSocketHandler(hub *stream.Hub) *WebSocketHandler {
|
|
return &WebSocketHandler{
|
|
hub: hub,
|
|
}
|
|
}
|
|
|
|
func (h *WebSocketHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
h.hub.ServeWS(w, r)
|
|
}
|