mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add support for modules.
This commit is contained in:
@ -6,4 +6,5 @@ import (
|
||||
|
||||
type ApiManager interface {
|
||||
Route(r chi.Router)
|
||||
AddRouter(path string, router func(chi.Router))
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package types
|
||||
|
||||
import "net/http"
|
||||
|
||||
type HandlerFunction func(Session, []byte) bool
|
||||
|
||||
type WebSocketPeer interface {
|
||||
Send(v interface{}) error
|
||||
Destroy() error
|
||||
@ -10,5 +12,6 @@ type WebSocketPeer interface {
|
||||
type WebSocketManager interface {
|
||||
Start()
|
||||
Shutdown() error
|
||||
AddHandler(handler HandlerFunction)
|
||||
Upgrade(w http.ResponseWriter, r *http.Request) error
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ import (
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
type HandlerFunction func(types.Session, []byte) bool
|
||||
|
||||
func New(
|
||||
sessions types.SessionManager,
|
||||
desktop types.DesktopManager,
|
||||
@ -35,7 +33,7 @@ func New(
|
||||
},
|
||||
},
|
||||
handler: handler.New(sessions, desktop, capture, webrtc),
|
||||
handlers: []HandlerFunction{},
|
||||
handlers: []types.HandlerFunction{},
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +46,7 @@ type WebSocketManagerCtx struct {
|
||||
sessions types.SessionManager
|
||||
desktop types.DesktopManager
|
||||
handler *handler.MessageHandlerCtx
|
||||
handlers []HandlerFunction
|
||||
handlers []types.HandlerFunction
|
||||
shutdown chan bool
|
||||
}
|
||||
|
||||
@ -149,7 +147,7 @@ func (ws *WebSocketManagerCtx) Shutdown() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ws *WebSocketManagerCtx) AddHandler(handler HandlerFunction) {
|
||||
func (ws *WebSocketManagerCtx) AddHandler(handler types.HandlerFunction) {
|
||||
ws.handlers = append(ws.handlers, handler)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user