https://kotlinlang.org logo
Title
n

Niro

02/26/2020, 3:00 PM
private val client by lazy {
        HttpClient(engine) {
            install(JsonFeature) {
                serializer = KotlinxSerializer(Json.nonstrict).apply {
                    setMapper(Todo::class, Todo.serializer())
                }
            }
            install(WebSockets)
        }
    }

    suspend fun fetchNotes(): List<Todo> {
        val jsonString2 = client.get<String> {
            url("$baseUrl/todos")
            
        }
        return Json.nonstrict.parse(multiNoteSerializer, jsonString2)
    }
c

cy

02/26/2020, 3:22 PM
This is only available at JVM
n

Niro

02/26/2020, 3:24 PM
Ahh so not possible at all.
c

cy

02/26/2020, 3:25 PM
Not all engines support it at all
n

Niro

02/26/2020, 3:26 PM
would it be possible then using the Android “OkHttpEngine”?
c

cy

02/26/2020, 3:27 PM
Yes, but you need to configure okhttp client with
config
block
HttpClient(OkHttp) {
    engine {
        config {
            pingInterval(...)
        }
    }
}