Documentation ¶
Index ¶
- Constants
- func AddUser(u *User)
- func AppendChannel(key string, value *Channel)
- func DeleteChannel(key string)
- func GetUserClientNums() int
- func GetUserNums() int
- func IsUserOnline(userId string) bool
- type Channel
- type Client
- func (c *Client) Close(code int, msg string) error
- func (c *Client) GetCreateTime() int64
- func (c *Client) GetDevice() string
- func (c *Client) GetId() string
- func (c *Client) GetLoginTime() int64
- func (c *Client) GetUUID() string
- func (c *Client) GetUser() *User
- func (c *Client) Run() error
- func (c *Client) Send(msg interface{})
- type Connection
- type Hub
- type User
- func (u *User) AppendClient(c *Client)
- func (u *User) ClientUnRegister(clientId string, channel *Channel)
- func (u *User) DeleteClient(clientId string)
- func (u *User) GetClient(clientId string) (*Client, bool)
- func (u *User) GetClients() map[string]*Client
- func (u *User) SendToAllClients(msg interface{})
- func (u *User) Subscribe(channel *Channel)
- func (u *User) UnSubscribe(channel *Channel)
Constants ¶
View Source
const ( VISITOR = 0 NOMALUSER = 1 MANAGER = 2 )
Variables ¶
This section is empty.
Functions ¶
func AppendChannel ¶
func DeleteChannel ¶
func DeleteChannel(key string)
func GetUserClientNums ¶
func GetUserClientNums() int
func GetUserNums ¶
func GetUserNums() int
func IsUserOnline ¶
Types ¶
type Channel ¶
Channel struct of room or personal chan dec
func GetChannel ¶
func NewChannel ¶
func (*Channel) GetRegisterNumber ¶
func (*Channel) UnRegister ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a middleman between the websocket connection and the hub
func NewClient ¶
func NewClient(id, device, uuid string, createTime, loginTime int64, conn Connection, u *User) *Client
func (*Client) GetCreateTime ¶
func (*Client) GetLoginTime ¶
type Connection ¶
type Hub ¶
Hub maintains the set of active clients and broadcasts messages to the clients.
func (*Hub) GetAllClients ¶
type User ¶
User struct
func (*User) AppendClient ¶
func (*User) ClientUnRegister ¶
func (*User) DeleteClient ¶
func (*User) GetClients ¶
func (*User) SendToAllClients ¶
func (u *User) SendToAllClients(msg interface{})
func (*User) UnSubscribe ¶
Click to show internal directories.
Click to hide internal directories.