createServiceWorkerWithConnection

Creates a connection to a service worker registered at workerScriptPath.

This is an experimental API — the service-worker transport has limited test coverage and its behavior may change without notice. Opt in explicitly with @OptIn(ExperimentalKsrpc::class).

Creates a connection to a service worker registered at workerScriptPath.

Samples

val env = ksrpcEnvironment { }
val connection = createServiceWorkerWithConnection("/worker.js", env)
val service = connection.defaultChannel().toStub<GreetingService, String>()

Creates a connection to a service worker registered at workerScriptPath.

This is an experimental API — the service-worker transport has limited test coverage and its behavior may change without notice. Opt in explicitly with @OptIn(ExperimentalKsrpc::class).