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

Method SendAccountData

userapi/producers/syncapi.go:37–58  ·  view source on GitHub ↗

SendAccountData sends account data to the Sync API server.

(userID string, data eventutil.AccountData)

Source from the content-addressed store, hash-verified

35
36// SendAccountData sends account data to the Sync API server.
37func (p *SyncAPI) SendAccountData(userID string, data eventutil.AccountData) error {
38 m := &nats.Msg{
39 Subject: p.clientDataTopic,
40 Header: nats.Header{},
41 }
42 m.Header.Set(jetstream.UserID, userID)
43
44 var err error
45 m.Data, err = json.Marshal(data)
46 if err != nil {
47 return err
48 }
49
50 log.WithFields(log.Fields{
51 "user_id": userID,
52 "room_id": data.RoomID,
53 "data_type": data.Type,
54 }).Tracef("Producing to topic '%s'", p.clientDataTopic)
55
56 _, err = p.producer.PublishMsg(m)
57 return err
58}
59
60// GetAndSendNotificationData reads the database and sends data about unread
61// notifications to the Sync API server.

Callers 3

InputAccountDataMethod · 0.80
PerformPushRulesPutMethod · 0.80

Calls 2

PublishMsgMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected