https://kotlinlang.org logo
#ktor
Title
# ktor
t

Trey

06/22/2022, 8:19 PM
Can somebody explain how to configure SSL with Darwin HttpClient? I'm getting this exception when I try to connect to a web socket over SSL. io.ktor.client.engine.darwin.DarwinHttpRequestException: Exception in http request: Error Domain=NSURLErrorDomain Code=-1011 "There was a bad response from the server."
The docs show all but Darwin. https://ktor.io/docs/client-ssl.html
l

Landry Norris

06/22/2022, 9:50 PM
Is the CIO engine a choice for you?
This ticket is from a few months ago, but it looks like SSL was JVM only at the time.
The ticket mentions a task to implement SSL in CIO, but I don’t know if that’s ready or not.
t

Trey

06/22/2022, 10:05 PM
I get an error stating that TLS isn't supported on native, which was why I was trying Darwin.
a

Aleksei Tirman [JB]

06/23/2022, 11:52 AM
The Darwin engine should work with SSL out-of-the-box. Are you able to connect to the server with another client?
t

Trey

06/23/2022, 1:52 PM
My issue is when using a web socket. Other calls work fine. I can connect to the web socket fine when running the Android version of that app that uses the same shared code. The Android version is using OkHttp.
a

Aleksei Tirman [JB]

06/24/2022, 8:43 AM
Could you please file an issue with an attached sample project that demonstrates this problem?
👍 1
t

Trey

06/24/2022, 5:52 PM
I have a follow up question. I'm noticing that when I use the CIO engine with the Android build, the web socket works fine. I'm not adding any additional configuration to that engine other than logging. When I switch to OkHttp for the engine I get failures. Is there additional configuration required for OkHttp to connect to web sockets? I'm wondering if this is what I'm running into on iOS too.
a

Aleksei Tirman [JB]

06/24/2022, 6:00 PM
Is there additional configuration required for OkHttp to connect to web sockets?
It isn’t required.
I’m wondering if this is what I’m running into on iOS too
The native Websockets support for the
Darwin
engine was introduced in Ktor 2.0.0 so most likely there is some other kind of problem.
76 Views