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

Method SendTyping

clientapi/producers/syncapi.go:133–147  ·  view source on GitHub ↗
(
	ctx context.Context, userID, roomID string, typing bool, timeoutMS int64,
)

Source from the content-addressed store, hash-verified

131}
132
133func (p *SyncAPIProducer) SendTyping(
134 ctx context.Context, userID, roomID string, typing bool, timeoutMS int64,
135) error {
136 m := &nats.Msg{
137 Subject: p.TopicTypingEvent,
138 Header: nats.Header{},
139 }
140 m.Header.Set(jetstream.UserID, userID)
141 m.Header.Set(jetstream.RoomID, roomID)
142 m.Header.Set("typing", strconv.FormatBool(typing))
143 m.Header.Set("timeout_ms", strconv.Itoa(int(timeoutMS)))
144
145 _, err := p.JetStream.PublishMsg(m, nats.Context(ctx))
146 return err
147}
148
149func (p *SyncAPIProducer) SendPresence( // 发送出席消息(比如进入某个房间)
150 ctx context.Context, userID string, presence types.Presence, statusMsg *string,

Callers 1

SendTypingFunction · 0.45

Calls 3

PublishMsgMethod · 0.80
ContextMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected