package syncapi import ( "context" "encoding/json" "time" ) // Outbound passes this server's ephemeral events on to other servers. // // Typing notifications, read receipts and to-device messages are not room // events and never go through the roomserver, so the federation queue // cannot pick them up from there; the sync API, which is where they are // written, hands them over instead. Only what a local user did is handed // over — the same calls are how an EDU from another server is taken in, // and passing those on again would echo them back to where they came // from. // // Every method must return quickly: they are called on the request path // of the client that typed, read or sent. type Outbound interface { Typing(ctx context.Context, roomID, userID string, typing bool, timeout time.Duration) Receipt(ctx context.Context, roomID, userID, receiptType, eventID, threadID string, ts int64) ToDevice(ctx context.Context, sender, eventType string, messages map[string]map[string]json.RawMessage) } // SetOutbound connects the federation queue. It is a setter rather than an // option because the queue is built after the sync API's dependencies and // before the sync API is serving, and nil — no federation — is a valid // value throughout. func (s *API) SetOutbound(o Outbound) { s.outbound = o }