diff --git a/common/src/commonMain/kotlin/com/jaytux/phoebench/common/CSERoute.kt b/common/src/commonMain/kotlin/com/jaytux/phoebench/common/CSERoute.kt index fd22149..3e0b670 100644 --- a/common/src/commonMain/kotlin/com/jaytux/phoebench/common/CSERoute.kt +++ b/common/src/commonMain/kotlin/com/jaytux/phoebench/common/CSERoute.kt @@ -15,7 +15,7 @@ sealed class CSERoute(val path: String, val elevation: Ele abstract fun extractParams(reqParams: Parameters): TParams? suspend fun call(client: IClient, params: TParams, body: suspend (sender: suspend (TEvent) -> Unit) -> Unit): Either { - 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 try { client.client.webSocket("$server${buildUrl(params)}", {}) {