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

Method sendNotificationData

userapi/producers/syncapi.go:81–101  ·  view source on GitHub ↗

sendNotificationData sends data about unread notifications to the Sync API server.

(userID string, data *eventutil.NotificationData)

Source from the content-addressed store, hash-verified

79
80// sendNotificationData sends data about unread notifications to the Sync API server.
81func (p *SyncAPI) sendNotificationData(userID string, data *eventutil.NotificationData) error {
82 m := &nats.Msg{
83 Subject: p.notificationDataTopic,
84 Header: nats.Header{},
85 }
86 m.Header.Set(jetstream.UserID, userID)
87
88 var err error
89 m.Data, err = json.Marshal(data)
90 if err != nil {
91 return err
92 }
93
94 log.WithFields(log.Fields{
95 "user_id": userID,
96 "room_id": data.RoomID,
97 }).Tracef("Producing to topic '%s'", p.clientDataTopic)
98
99 _, err = p.producer.PublishMsg(m)
100 return err
101}

Callers 1

Calls 2

PublishMsgMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected