StreamLinkConnection

interface StreamLinkConnection : StreamLink, AutoCloseable(source)

A coroutine- and Flow-friendly wrapper around a Caplin StreamLink connection.

Extends the raw StreamLink API with suspending helpers for awaiting connection and service state, and with getSubject/getChannel overloads that expose subscriptions and channels as cold Flows of Events. Instances are created via StreamLinkConnectionFactory.connect.

Implements AutoCloseable; closing disconnects the underlying StreamLink.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val connectionCurrentState: ConnectionCurrentState?
Link copied to clipboard
abstract val customAttributes: Map<String?, String?>?
Link copied to clipboard
abstract val lastLog: List<LogInfo?>?
Link copied to clipboard
abstract val logger: Logger?
Link copied to clipboard
abstract val state: SharedFlow<ConnectionStatusEvent>

A hot SharedFlow of connection status changes, replaying the latest event to collectors.

Link copied to clipboard
abstract val username: String

The username this connection is authenticated as.

Link copied to clipboard
abstract val version: String?

Functions

Link copied to clipboard
abstract fun addConnectionListener(p0: ConnectionListener?)
Link copied to clipboard
open suspend fun awaitConnected()

Suspends until the connection reaches the ConnectionState.LOGGEDIN state.

Link copied to clipboard
open suspend fun awaitServiceUp(name: String)

Suspends until the service named name reports ServiceStatus.OK, polling periodically.

Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract fun connect()
Link copied to clipboard
abstract fun create(p0: String?, p1: CommandParameters?, p2: CommandResultListener?): CommandSubscription?
Link copied to clipboard
abstract fun createChannel(p0: String?, p1: ChannelListener?, p2: CommandParameters?): Channel?
Link copied to clipboard
abstract fun createCommandParameters(): CommandParameters?
Link copied to clipboard
abstract fun createContainerSubscriptionParameters(): ContainerSubscriptionParameters?
Link copied to clipboard
abstract fun createFreeFormSubscriptionParameters(): FreeFormSubscriptionParameters?
Link copied to clipboard
abstract fun createJsonChannel(p0: String?, p1: JsonChannelListener?, p2: CommandParameters?): JsonChannel?
Link copied to clipboard
abstract fun createJsonSubscriptionParameters(): JsonSubscriptionParameters?
Link copied to clipboard
abstract fun createRecordSubscriptionParameters(): RecordSubscriptionParameters?
Link copied to clipboard
abstract fun createSubject(p0: String?, p1: SubjectType?, p2: CommandListener?)
abstract fun createSubject(p0: String?, p1: SubjectType?, p2: CommandListener?, p3: CommandParameters?): CommandSubscription?
Link copied to clipboard
abstract fun createWebRequestParameters(p0: String?, p1: Map<String?, String?>?): WebRequestParameters?
Link copied to clipboard
abstract fun delete(p0: String?, p1: CommandParameters?, p2: CommandResultListener?): CommandSubscription?
Link copied to clipboard
abstract fun deleteSubject(p0: String?, p1: CommandListener?)
Link copied to clipboard
abstract fun disconnect()
Link copied to clipboard
abstract fun getChannel(subject: Subject, send: Flow<Map<String, String>>): Flow<RecordEvent>

Opens a record channel on subject, sending each emitted field map from send to the server and emitting the server's record updates as RecordEvents.

abstract fun <T, R> getChannel(subject: Subject, send: Flow<T>, type: KClass<R & Any>): Flow<Event<R>>

Opens a JSON channel on subject, sending each item from send to the server and emitting the server's updates deserialised to type.

Link copied to clipboard
inline fun <T, R : Any> StreamLinkConnection.getChannel(subject: Subject, send: Flow<T>): Flow<Event<R>>

Opens a bidirectional channel on subject, sending items from send and receiving updates deserialised to R. Reified convenience for getChannel taking an explicit KClass.

Link copied to clipboard

Subscribes to the container at subject, emitting a ContainerChangeEvent for each row add, remove or clear as its membership changes.

Link copied to clipboard
abstract fun getSubject(subject: Subject): Flow<RecordEvent>

Subscribes to the record at subject, emitting a RecordEvent for each field update.

abstract fun <T> getSubject(subject: Subject, type: KClass<T & Any>): Flow<Event<T>>

Subscribes to the JSON record at subject, deserialising each update to type.

Link copied to clipboard
inline fun <T : Any> StreamLinkConnection.getSubject(subject: Subject): Flow<Event<T>>

Subscribes to subject, deserialising each JSON update to T. Reified convenience for getSubject taking an explicit KClass.

Link copied to clipboard
abstract fun networkAvailable()
Link copied to clipboard
abstract fun networkUnavailable()
Link copied to clipboard
abstract fun pause()
Link copied to clipboard
abstract fun publish(p0: String?, p1: CommandParameters?, p2: CommandResultListener?): CommandSubscription?
Link copied to clipboard
abstract fun publishToJsonSubject(p0: String?, p1: Any?, p2: CommandListener?, p3: CommandParameters?): CommandSubscription?
Link copied to clipboard
abstract fun publishToSubject(p0: String?, p1: List<STuple?>?, p2: CommandListener?)
abstract fun publishToSubject(p0: String?, p1: Map<String?, String?>?, p2: CommandListener?)
abstract fun publishToSubject(p0: String?, p1: List<STuple?>?, p2: CommandListener?, p3: CommandParameters?): CommandSubscription?
abstract fun publishToSubject(p0: String?, p1: Map<String?, String?>?, p2: CommandListener?, p3: CommandParameters?): CommandSubscription?
Link copied to clipboard
abstract fun registerJsonProvider(p0: String?, p1: JsonProvider?, p2: CommandListener?): JsonProviderHandle?
Link copied to clipboard
abstract fun registerRecordProvider(p0: String?, p1: RecordProvider?, p2: CommandListener?): RecordProviderHandle?
Link copied to clipboard
abstract fun removeConnectionListener(p0: ConnectionListener?)
Link copied to clipboard
abstract fun resume()
Link copied to clipboard
abstract fun snapshot(p0: String?, p1: SubscriptionListener?)
abstract fun snapshot(p0: String?, p1: SubscriptionListener?, p2: SubscriptionParameters?)
Link copied to clipboard
abstract fun subscribe(p0: String?, p1: SubscriptionListener?): Subscription?
abstract fun subscribe(p0: String?, p1: SubscriptionListener?, p2: SubscriptionParameters?): Subscription?
Link copied to clipboard
abstract fun throttleEverything(p0: ThrottleCommand?, p1: CommandListener?)
abstract fun throttleEverything(p0: ThrottleCommand?, p1: CommandListener?, p2: CommandParameters?): CommandSubscription?
Link copied to clipboard
abstract fun throttleSubject(p0: String?, p1: ThrottleCommand?, p2: CommandListener?)
abstract fun throttleSubject(p0: String?, p1: ThrottleCommand?, p2: CommandListener?, p3: CommandParameters?): CommandSubscription?