Documentation
¶
Index ¶
- Constants
- type Client
- type Message
- type PubSub
- func (ps *PubSub) AddClient(c Client) *PubSub
- func (ps *PubSub) GetSubscriptions(topic string, client *Client) []Subscription
- func (ps *PubSub) HandleReceiveMessage(c Client, messageType int, message []byte) *PubSub
- func (ps *PubSub) Publish(topic string, message []byte, excludeClient *Client)
- func (ps *PubSub) RemoveClient(c Client) *PubSub
- func (ps *PubSub) Subscribe(client *Client, topic string) *PubSub
- func (ps *PubSub) Unsubscribe(c *Client, topic string) *PubSub
- type Subscription
Constants ¶
View Source
const ( PUBLISH = "publish" UNSUBSCRIBE = "unsubscribe" SUBSCRIBE = "subscribe" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { Action string `json:"action"` Topic string `json:"topic"` Message json.RawMessage `json:"message"` }
Message - struct
type PubSub ¶
type PubSub struct { Clients []Client Subscriptions []Subscription }
PubSub - struct
func (*PubSub) GetSubscriptions ¶
func (ps *PubSub) GetSubscriptions(topic string, client *Client) []Subscription
GetSubscriptions - client
func (*PubSub) HandleReceiveMessage ¶
HandleReceiveMessage - struct
func (*PubSub) RemoveClient ¶
RemoveClient - remove subscription and client pub/sub
Click to show internal directories.
Click to hide internal directories.