Documentation ¶
Index ¶
- type Client
- type PubSub
- func (ps *PubSub) AddClient(client *Client) *PubSub
- func (ps *PubSub) PublishBytes(topic string, msg []byte)
- func (ps *PubSub) PublishJSON(topic string, msg any)
- func (ps *PubSub) PublishString(topic string, msg string)
- func (ps *PubSub) RemoveClient(client *Client) *PubSub
- func (ps *PubSub) Subscribe(client *Client, topic string) *Client
- func (ps *PubSub) Unsubscribe(client *Client, topic string)
- type PubSubMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Authorized bool `json:"authorized"` Closed bool `json:"-"` Id string `json:"id"` Topics []string `json:"topics"` Connection *websocket.Conn `json:"-"` Mutex sync.Mutex `json:"-"` }
func (*Client) SendMessage ¶
type PubSub ¶
type PubSub struct { TotalClients int `json:"totalClients"` TotalTopics int `json:"totalTopics"` Clients []*Client `json:"clients"` Topics map[string][]*Client `json:"topics"` }
func (*PubSub) PublishBytes ¶
func (*PubSub) PublishJSON ¶
func (*PubSub) PublishString ¶
func (*PubSub) RemoveClient ¶
func (*PubSub) Unsubscribe ¶
Click to show internal directories.
Click to hide internal directories.