36 lines
593 B
Go
36 lines
593 B
Go
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
|
|
}
|