package contracts import ( "net/http" "git.fsdpf.net/go/req" "github.com/gorilla/websocket" ) type WsClientGroup string type WsClientID uint const DefaultWsClientGroup WsClientGroup = "__DEFAULT__" type WsClient interface { req.User Socket() *websocket.Conn WsClientID() WsClientID WsClientGroup() WsClientGroup WsClientManage() WsClientManage Lock() Unlock() } type WsClientManage interface { Register(WsClient) bool Unregister(WsClient) GetClients(func(WsClient) bool) []WsClient } type WsChannelManage interface { Channel(string) WsClientManage } type WsController interface { Controller // 获取请求信息 Request() *http.Request // 请求处理 Execute(req.GlobalParams) error // 获取用户信息 User() req.User // 路由信息 Route() req.Route // 获取 Ws 客户端 Client() WsClient // 获取 Ws 标识 ClientID(req.GlobalParams) WsClientID // 获取 Ws 分组 ClientGroup(req.GlobalParams) WsClientGroup }