recentChatsTopEvents method
Subscribes to updates of top count items of recentChats list.
Note, that EventRecentChatsUpdated informs about a Chat becoming the topmost in recentChats list, but never about a Chat being updated itself.
Note, that EventRecentChatsDeleted informs about a Chat being removed
from top count items of recentChats list, but never about a Chat
being removed itself.
Instead, use chatEvents for being informed correctly about Chat changes.
Authentication
Mandatory.
Initialization
Once this subscription is initialized completely, it immediately emits
SubscriptionInitialized followed by the initial state of the
RecentChatsTop list (and they won't be emitted ever again until this
subscription completes). Note, that emitting an empty list is possible
valid.
If nothing has been emitted for a long period of time after establishing this subscription (while not being completed), it should be considered as an unexpected server error. This fact can be used on a client side to decide whether this subscription has been initialized successfully.
Completion
Infinite.
Completes requiring a re-subscription when:
- Authenticated Session expires (
SESSION_EXPIREDerror is emitted). - An error occurs on the server (error is emitted).
- The server is shutting down or becoming unreachable (unexpectedly completes after initialization).
Implementation
Stream<QueryResult> recentChatsTopEvents(
int count, {
bool noFavorite = true,
bool archived = false,
bool? withOngoingCalls,
}) {
Log.debug(
'recentChatsTopEvents($count, $noFavorite, $withOngoingCalls)',
'$runtimeType',
);
final variables = RecentChatsTopEventsArguments(
count: count,
kw$with: RecentChatsFilter(
noFavorite: noFavorite,
ongoingCalls: withOngoingCalls,
archived: archived,
),
);
return client.subscribe(
SubscriptionOptions(
operationName: 'RecentChatsTopEvents',
document: RecentChatsTopEventsSubscription(
variables: variables,
).document,
variables: variables.toJson(),
),
);
}