subscribeToStream

abstract fun subscribeToStream(sub: (T) -> Unit = {}): Unsubscribe

Adds a subscription to the stream.

On subscribing the subscription is immediately called with the current value.

Returns an unsubscribe function. Calling this function unsubscribes from the stream.