1 Commits
Author SHA1 Message Date
jaytux 126a3bfff2 Clients: use http->ws, https->wss 2026-09-01 15:17:39 +02:00
@@ -15,7 +15,7 @@ sealed class CSERoute<TParams, TEvent: Any>(val path: String, val elevation: Ele
abstract fun extractParams(reqParams: Parameters): TParams? abstract fun extractParams(reqParams: Parameters): TParams?
suspend fun call(client: IClient, params: TParams, body: suspend (sender: suspend (TEvent) -> Unit) -> Unit): Either<ErrorResponse, Unit> { suspend fun call(client: IClient, params: TParams, body: suspend (sender: suspend (TEvent) -> Unit) -> Unit): Either<ErrorResponse, Unit> {
val server = client.serverUrl.replace("https", "ws").replace("http", "ws") val server = if(client.serverUrl.startsWith("http")) client.serverUrl.replace("http", "ws") else "ws://${client.serverUrl}"
var error: ErrorResponse? = null var error: ErrorResponse? = null
try { try {
client.client.webSocket("$server${buildUrl(params)}", {}) { client.client.webSocket("$server${buildUrl(params)}", {}) {