getTimelineEvents

abstract fun getTimelineEvents(roomId: RoomId, startFrom: EventId, direction: GetEvents.Direction = BACKWARDS, config: GetTimelineEventsConfig.() -> Unit = {}): Flow<Flow<TimelineEvent>>

Returns a flow of timeline events wrapped in a flow. It emits, when there is a new timeline event. This flow only completes, when the start of the timeline is reached or GetTimelineEventsConfig.minSize and/or GetTimelineEventsConfig.maxSize are set and reached.

Consuming this flow directly needs proper understanding of how flows work. For example: if the client is offline and there are 5 timeline events in store, but take(10) is used, then toList() will suspend.

Consider using GetTimelineEventsConfig.minSize and GetTimelineEventsConfig.maxSize when consuming this flow directly (e.g. with toList()). This can work like paging through the timeline. It also completes the flow, which is not the case, when both parameters are null.


abstract fun getTimelineEvents(response: Sync.Response, decryptionTimeout: Duration = 30.seconds): Flow<TimelineEvent>