rename WebSocket handler.

This commit is contained in:
Miroslav Šedivý 2021-08-29 23:01:51 +02:00
parent c82a083fb6
commit 402b8f1a08
2 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@ type WebSocketMessage struct {
Payload json.RawMessage `json:"payload"`
}
type HandlerFunction func(Session, WebSocketMessage) bool
type WebSocketHandler func(Session, WebSocketMessage) bool
type CheckOrigin func(r *http.Request) bool
@ -22,6 +22,6 @@ type WebSocketPeer interface {
type WebSocketManager interface {
Start()
Shutdown() error
AddHandler(handler HandlerFunction)
AddHandler(handler WebSocketHandler)
Upgrade(w http.ResponseWriter, r *http.Request, checkOrigin CheckOrigin)
}

View File

@ -28,7 +28,7 @@ func New(
sessions: sessions,
desktop: desktop,
handler: handler.New(sessions, desktop, capture, webrtc),
handlers: []types.HandlerFunction{},
handlers: []types.WebSocketHandler{},
}
}
@ -40,7 +40,7 @@ type WebSocketManagerCtx struct {
sessions types.SessionManager
desktop types.DesktopManager
handler *handler.MessageHandlerCtx
handlers []types.HandlerFunction
handlers []types.WebSocketHandler
}
func (manager *WebSocketManagerCtx) Start() {
@ -156,7 +156,7 @@ func (manager *WebSocketManagerCtx) Shutdown() error {
return nil
}
func (manager *WebSocketManagerCtx) AddHandler(handler types.HandlerFunction) {
func (manager *WebSocketManagerCtx) AddHandler(handler types.WebSocketHandler) {
manager.handlers = append(manager.handlers, handler)
}