buildKtorSubscriptionKey

inline fun <T> buildKtorSubscriptionKey(id: SubscriptionId<T> = SubscriptionId.auto(), crossinline subscribe: HttpClient.() -> Flow<T>): SubscriptionKey<T>

A delegation function to build a SubscriptionKey for Ktor.

class ExampleSubscriptionKey(auto: Namespace) : SubscriptionKey<String> by buildKtorSubscriptionKey(
id = SubscriptionId(auto.value),
subscribe = { // HttpClient.() -> Flow<String>
doSomethingFlow()
}
)

Note: httpClient is required to use the builder functions designed for soil.query.core.ContextReceiver.

Parameters

id

The identifier of the subscription key.

subscribe

The subscription function for receiving data, such as from a server.