API reference

HorizonServiceConnection

Updated: Jun 23, 2025

HorizonServiceConnection

class HorizonServiceConnection
Service connection class responsible for delegating requests over platform layers. This class is single-instance and must be initialized with HorizonServiceConnection.connect and accessed via HorizonServiceConnection.instance. An instance can immediately be used any time after calling connect but the first requests may delay until initialization is complete to execute.
Parameters
JVM
NameSummary
config
Optional configuration data to give the user more control over execution where possible

Types

NameSummary
Companion
object Companion
sealed class InitializationStage

Functions

NameSummary
logEvent
fun logEvent(eventType: String, eventData: LogEventData = LogEventData())
makeRequest
suspend fun makeRequest(moduleName: String, requestName: String, version: Int, requestData: String?): Message
Make a one-shot request, suspending until a response is received
makeSession
fun makeSession(moduleName: String, requestName: String, version: Int, requestData: String?): Flow<Message>
Make a session request, opening a flow which will emit one or more responses. The returned flow must be collected in order to send the session request, and will stop if the collecting scope is cancelled.

Companion

object Companion

Properties

NameSummary
instance
val instance: HorizonServiceConnection
Acquire a reference to the Horizon Platform instance, which can be used to make raw requests and sessions. You probably shouldn’t ever need to use this.

Functions

NameSummary
connect
fun connect(applicationId: String, scope: CoroutineScope = CoroutineScope(Dispatchers.Unconfined), config: HorizonPlatformConfig = HorizonPlatformConfig())
Initialize the Horizon Platform. This method must be called before any other service methods can be executed.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon