MCPcopy
hub / github.com/redis/go-redis / Subscribe

Method Subscribe

redis.go:1597–1603  ·  view source on GitHub ↗

Subscribe subscribes the client to the specified channels. Channels can be omitted to create empty subscription. Note that this method does not wait on a response from Redis, so the subscription may not be active immediately. To force the connection to wait, you may call the Receive() method on the

(ctx context.Context, channels ...string)

Source from the content-addressed store, hash-verified

1595//
1596// ch := sub.Channel()
1597func (c *Client) Subscribe(ctx context.Context, channels ...string) *PubSub {
1598 pubsub := c.pubSub()
1599 if len(channels) > 0 {
1600 _ = pubsub.Subscribe(ctx, channels...)
1601 }
1602 return pubsub
1603}
1604
1605// PSubscribe subscribes the client to the given patterns.
1606// Patterns can be omitted to create empty subscription.

Callers

nothing calls this directly

Calls 2

pubSubMethod · 0.95
SubscribeMethod · 0.65

Tested by

no test coverage detected