contracts/ws.go

36 lines
593 B
Go
Raw Normal View History

2024-05-09 13:15:24 +08:00
package contracts
import (
"git.fsdpf.net/go/req"
"github.com/gorilla/websocket"
)
type WsClientGroup string
type WsClientID uint
// type WsClient struct {
// User
// Group WsClientGroup
// Socket *websocket.Conn
// }
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
}