Documentation ¶
Index ¶
- Constants
- func Broadcast(message interface{}, ignoreId string) error
- func Close() error
- func Publish(channel string, message interface{}, ignoreId string) error
- func SendMessage(clientId, channel string, message interface{}) (bool, error)
- func Subscribe(clientId string, channel string) bool
- func Unsubscribe(clientId string, channel string) bool
- type Channel
- type Client
- func (c *Client) Channels() []*Channel
- func (c *Client) Clear()
- func (c *Client) Close()
- func (c *Client) Read()
- func (c *Client) SendMessage(message []byte)
- func (c *Client) Subscribe(channel string)
- func (c *Client) Subscribers(channels []string)
- func (c *Client) Unsubscribe(channel string)
- func (c *Client) Unsubscribers(channels []string)
- func (c *Client) Write()
- type ClientWS
- type Conn
- type Hub
- func (hub *Hub) Broadcast(message interface{}, ignoreId string)
- func (hub *Hub) GetSubscribers(channel string) []*Client
- func (hub *Hub) Publish(channel string, message interface{}, ignoreId string)
- func (hub *Hub) Run()
- func (hub *Hub) SendMessage(clientId, channel string, message interface{}) bool
- func (hub *Hub) Subscribe(clientId string, channel string) bool
- func (hub *Hub) Unsubscribe(clientId string, channel string) bool
- type WsMessage
Constants ¶
View Source
const ( MSG_CLIENT_CONNECT = "Client connected %s to Hub:%s" MSG_CLIENT_DISCONNECT = "Client disconnected %s to Hub:%s" ERR_NOT_WS_SERVICE = "not websocket service" ERR_NOT_DEFINE_CLIENTID = "not define clientId" ERR_NOT_DEFINE_USERNAME = "not define username" )
Variables ¶
This section is empty.
Functions ¶
func SendMessage ¶
func Unsubscribe ¶ added in v0.0.44
Types ¶
type Client ¶
func GetClients ¶
func GetClients() []*Client
func GetSubscribers ¶
func (*Client) SendMessage ¶
func (*Client) Subscribers ¶
func (*Client) Unsubscribe ¶
func (*Client) Unsubscribers ¶
type ClientWS ¶ added in v0.0.138
type ClientWS struct {
// contains filtered or unexported fields
}
type Hub ¶
type Hub struct { Id string // contains filtered or unexported fields }
func (*Hub) GetSubscribers ¶
func (*Hub) SendMessage ¶
Send a message to a client in a channel
Click to show internal directories.
Click to hide internal directories.