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"`
|
Payload json.RawMessage `json:"payload"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HandlerFunction func(Session, WebSocketMessage) bool
|
type WebSocketHandler func(Session, WebSocketMessage) bool
|
||||||
|
|
||||||
type CheckOrigin func(r *http.Request) bool
|
type CheckOrigin func(r *http.Request) bool
|
||||||
|
|
||||||
@ -22,6 +22,6 @@ type WebSocketPeer interface {
|
|||||||
type WebSocketManager interface {
|
type WebSocketManager interface {
|
||||||
Start()
|
Start()
|
||||||
Shutdown() error
|
Shutdown() error
|
||||||
AddHandler(handler HandlerFunction)
|
AddHandler(handler WebSocketHandler)
|
||||||
Upgrade(w http.ResponseWriter, r *http.Request, checkOrigin CheckOrigin)
|
Upgrade(w http.ResponseWriter, r *http.Request, checkOrigin CheckOrigin)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func New(
|
|||||||
sessions: sessions,
|
sessions: sessions,
|
||||||
desktop: desktop,
|
desktop: desktop,
|
||||||
handler: handler.New(sessions, desktop, capture, webrtc),
|
handler: handler.New(sessions, desktop, capture, webrtc),
|
||||||
handlers: []types.HandlerFunction{},
|
handlers: []types.WebSocketHandler{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ type WebSocketManagerCtx struct {
|
|||||||
sessions types.SessionManager
|
sessions types.SessionManager
|
||||||
desktop types.DesktopManager
|
desktop types.DesktopManager
|
||||||
handler *handler.MessageHandlerCtx
|
handler *handler.MessageHandlerCtx
|
||||||
handlers []types.HandlerFunction
|
handlers []types.WebSocketHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *WebSocketManagerCtx) Start() {
|
func (manager *WebSocketManagerCtx) Start() {
|
||||||
@ -156,7 +156,7 @@ func (manager *WebSocketManagerCtx) Shutdown() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (manager *WebSocketManagerCtx) AddHandler(handler types.HandlerFunction) {
|
func (manager *WebSocketManagerCtx) AddHandler(handler types.WebSocketHandler) {
|
||||||
manager.handlers = append(manager.handlers, handler)
|
manager.handlers = append(manager.handlers, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user