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

Method Publish

pubsub_commands.go:20–28  ·  view source on GitHub ↗

Publish posts the message to the channel.

(ctx context.Context, channel string, message interface{})

Source from the content-addressed store, hash-verified

18
19// Publish posts the message to the channel.
20func (c cmdable) Publish(ctx context.Context, channel string, message interface{}) *IntCmd {
21 cmd := NewIntCmd(ctx, "publish", channel, message)
22 _ = c(ctx, cmd)
23 // Record PubSub message sent (if command succeeded)
24 if cmd.Err() == nil {
25 otel.RecordPubSubMessage(ctx, nil, "sent", channel, false)
26 }
27 return cmd
28}
29
30func (c cmdable) SPublish(ctx context.Context, channel string, message interface{}) *IntCmd {
31 cmd := NewIntCmd(ctx, "spublish", channel, message)

Callers

nothing calls this directly

Calls 3

RecordPubSubMessageFunction · 0.92
NewIntCmdFunction · 0.85
ErrMethod · 0.65

Tested by

no test coverage detected