MCPcopy Create free account
hub / github.com/daodst/chat / SendPresence

Method SendPresence

clientapi/producers/syncapi.go:149–163  ·  view source on GitHub ↗
( // 发送出席消息(比如进入某个房间)
	ctx context.Context, userID string, presence types.Presence, statusMsg *string,
)

Source from the content-addressed store, hash-verified

147}
148
149func (p *SyncAPIProducer) SendPresence( // 发送出席消息(比如进入某个房间)
150 ctx context.Context, userID string, presence types.Presence, statusMsg *string,
151) error {
152 m := nats.NewMsg(p.TopicPresenceEvent)
153 m.Header.Set(jetstream.UserID, userID)
154 m.Header.Set("presence", presence.String())
155 if statusMsg != nil {
156 m.Header.Set("status_msg", *statusMsg)
157 }
158
159 m.Header.Set("last_active_ts", strconv.Itoa(int(gomatrixserverlib.AsTimestamp(time.Now()))))
160
161 _, err := p.JetStream.PublishMsg(m, nats.Context(ctx))
162 return err
163}

Callers

nothing calls this directly

Calls 4

PublishMsgMethod · 0.80
ContextMethod · 0.80
SetMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected