SSubscribe Subscribes the client to the specified shard channels.
(ctx context.Context, channels ...string)
| 261 | |
| 262 | // SSubscribe Subscribes the client to the specified shard channels. |
| 263 | func (c *PubSub) SSubscribe(ctx context.Context, channels ...string) error { |
| 264 | c.mu.Lock() |
| 265 | defer c.mu.Unlock() |
| 266 | |
| 267 | err := c.subscribe(ctx, "ssubscribe", channels...) |
| 268 | if c.schannels == nil { |
| 269 | c.schannels = make(map[string]struct{}) |
| 270 | } |
| 271 | for _, s := range channels { |
| 272 | c.schannels[s] = struct{}{} |
| 273 | } |
| 274 | return err |
| 275 | } |
| 276 | |
| 277 | // Unsubscribe the client from the given channels, or from all of |
| 278 | // them if none is given. |