turt2live / matrix-bot-sdk

TypeScript/JavaScript SDK for Matrix bots
MIT License
194 stars 68 forks source link

Gappy syncs support #336

Open KitsuneRal opened 1 year ago

KitsuneRal commented 1 year ago

Is your feature request related to a problem? Please describe. The current MatrixClient code is not suitable for the case when the bot needs to check each message. This is not necessarily the offline/online case but merely a high-traffic room (e.g. M2M cases with measurements/traces/pings etc. from many sources being sent as individual messages). Absent an option to register the bot as an application service, MatrixClient only syncs but never fills up gaps with /messages if a sync comes with limited: true.

Describe the solution you'd like It would be great if MatrixClient either could be configured to fill up gaps or at least exposed the batch tokens so that the bot code could do that.

Describe alternatives you've considered There don't seem to be feasible alternatives aside from using the application service API instead of client-server API (not an option if the bot cannot be registered on the homeserver). There doesn't seem to be a way to easily obtain batch tokens from syncs - if there were, the bot could call /messages itself and process the gaps as necessary.