rememberSubscription

fun <T> rememberSubscription(key: SubscriptionKey<T>, config: SubscriptionConfig = SubscriptionConfig.Default, client: SubscriptionClient = LocalSubscriptionClient.current): SubscriptionObject<T>

Remember a SubscriptionObject and subscribes to the subscription state of key.

Return

A SubscriptionObject each the subscription state changed.

Parameters

T

Type of data to receive.

key

The SubscriptionKey for managing subscription.

config

The configuration for the subscription. By default, it uses the SubscriptionConfig.Default.

client

The SubscriptionClient to resolve key. By default, it uses the LocalSubscriptionClient.


fun <T, U> rememberSubscription(key: SubscriptionKey<T>, select: (T) -> U, config: SubscriptionConfig = SubscriptionConfig.Default, client: SubscriptionClient = LocalSubscriptionClient.current): SubscriptionObject<U>

Remember a SubscriptionObject and subscribes to the subscription state of key.

Return

A SubscriptionObject with selected data each the subscription state changed.

Parameters

T

Type of data to receive.

U

Type of selected data.

key

The SubscriptionKey for managing subscription.

select

A function to select data from T.

config

The configuration for the subscription. By default, it uses the SubscriptionConfig.Default.

client

The SubscriptionClient to resolve key. By default, it uses the LocalSubscriptionClient.