getTimelineEvents

open override fun getTimelineEvents(startFrom: EventId, roomId: RoomId, direction: GetEvents.Direction, decryptionTimeout: Duration, fetchTimeout: Duration, limitPerFetch: Long, minSize: Long?, maxSize: Long?): 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 minSize and/or 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 minSize and 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.

To convert it to a flow of list, toFlowList can be used.

Parameters

limitPerFetch

The count of events requested from the server, when there is a gap.

minSize

Flow completes, when a gap is found and this size is reached (including the start event).

maxSize

Flow completes, when this value is reached (including the start event).