neko/internal/types/websocket.go
2021-08-29 19:17:10 +02:00

20 lines
374 B
Go

package types
import "net/http"
type HandlerFunction func(Session, []byte) bool
type CheckOrigin func(r *http.Request) bool
type WebSocketPeer interface {
Send(v interface{}) error
Destroy()
}
type WebSocketManager interface {
Start()
Shutdown() error
AddHandler(handler HandlerFunction)
Upgrade(w http.ResponseWriter, r *http.Request, checkOrigin CheckOrigin)
}