2020-10-23 03:54:50 +13:00
|
|
|
package types
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
2020-12-13 06:37:19 +13:00
|
|
|
type HandlerFunction func(Session, []byte) bool
|
|
|
|
|
2021-01-24 06:18:14 +13:00
|
|
|
type CheckOrigin func(r *http.Request) bool
|
|
|
|
|
2020-11-26 06:36:33 +13:00
|
|
|
type WebSocketPeer interface {
|
2020-10-23 03:54:50 +13:00
|
|
|
Send(v interface{}) error
|
|
|
|
Destroy() error
|
|
|
|
}
|
|
|
|
|
2020-11-02 04:09:48 +13:00
|
|
|
type WebSocketManager interface {
|
2020-10-29 08:29:18 +13:00
|
|
|
Start()
|
2020-10-23 03:54:50 +13:00
|
|
|
Shutdown() error
|
2020-12-13 06:37:19 +13:00
|
|
|
AddHandler(handler HandlerFunction)
|
2021-03-16 22:45:22 +13:00
|
|
|
Upgrade(w http.ResponseWriter, r *http.Request, checkOrigin CheckOrigin)
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|