Documentation ¶
Index ¶
- Constants
- func DoCmdAction(c *Client, cmd WSCmd)
- func InitWS()
- func InitWSX(addr string, c chan struct{})
- func LoginCMDHandler(c *Client, cmd WSCmd)
- func LoginCmdAction(c *Client, input LoginCmdInput)
- func RegisterCmdHandler(cmd string, handler WSCmdHandler)
- type Client
- type Hub
- type LoginCmdInput
- type WSCmd
- type WSCmdHandler
Constants ¶
View Source
const CmdNameLogin = "login"
Variables ¶
This section is empty.
Functions ¶
func DoCmdAction ¶
func LoginCMDHandler ¶
func LoginCmdAction ¶
func LoginCmdAction(c *Client, input LoginCmdInput)
func RegisterCmdHandler ¶
func RegisterCmdHandler(cmd string, handler WSCmdHandler)
Types ¶
type Client ¶
type Client struct { Hub *Hub // user identify ID string // contains filtered or unexported fields }
Client is a middleman between the websocket connection and the Hub.
func (*Client) SendFailureMsg ¶
func (*Client) SendFailureMsgWithErr ¶
func (*Client) SendSuccessMsg ¶
func (c *Client) SendSuccessMsg(msg interface{})
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active clients and broadcasts messages to the clients.
type LoginCmdInput ¶
type WSCmd ¶
type WSCmdHandler ¶
Click to show internal directories.
Click to hide internal directories.