Documentation
¶
Overview ¶
PubSub implements a simple Redis backed publish-subscribe client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
PubSub is a Redis pub/sub client. It uses a connection pool for communicating with Redis.
func (Conn) Close ¶
func (c Conn) Close()
Closes the connection to Redis. This closes the connection pool.
func (Conn) Subscribe ¶
Subscribe to topic and get messages received for this topic sent to the given channel.
func (Conn) SubscribeMessage ¶
Subscribe to topic and get messages received for this topic sent to the given channel as a message with an envelop that contains the topic name.
This can be used for distinguishing messages by topic if multiple subscriptions send to a single channel.
type Message ¶
type Message struct { Topic string `json:"topic"` Payload json.RawMessage `json:"payload"` }
Message is an envelop for a JSON message with lazy unmarshalling for the payload.