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

Method SendReceipt

clientapi/producers/syncapi.go:43–60  ·  view source on GitHub ↗
(
	ctx context.Context,
	userID, roomID, eventID, receiptType string, timestamp gomatrixserverlib.Timestamp,
)

Source from the content-addressed store, hash-verified

41}
42
43func (p *SyncAPIProducer) SendReceipt(
44 ctx context.Context,
45 userID, roomID, eventID, receiptType string, timestamp gomatrixserverlib.Timestamp,
46) error {
47 m := &nats.Msg{
48 Subject: p.TopicReceiptEvent,
49 Header: nats.Header{},
50 }
51 m.Header.Set(jetstream.UserID, userID)
52 m.Header.Set(jetstream.RoomID, roomID)
53 m.Header.Set(jetstream.EventID, eventID)
54 m.Header.Set("type", receiptType)
55 m.Header.Set("timestamp", fmt.Sprintf("%d", timestamp))
56
57 log.WithFields(log.Fields{}).Tracef("Producing to topic '%s'", p.TopicReceiptEvent)
58 _, err := p.JetStream.PublishMsg(m, nats.Context(ctx))
59 return err
60}
61
62func (p *SyncAPIProducer) SendToDevice(
63 ctx context.Context, sender, userID, deviceID, eventType string,

Callers 1

SetReceiptFunction · 0.45

Calls 3

PublishMsgMethod · 0.80
ContextMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected