mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
rename WebSocket handler.
This commit is contained in:
parent
c82a083fb6
commit
402b8f1a08
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user