https://kotlinlang.org logo
Title
o

Osman Saral

04/12/2023, 9:30 AM
Hi Everyone, I'm trying to run Web Socket client tests on iOS. Since ktor's
MockEngine
doesn't support Web Sockets, I setup a
TestServerPlugin
like ktor did in their repo. This way a websocket server starts on the localhost, and client can connect to the server and run the tests. This works perfectly with Android. But on iOS I get the error below. I think iOS simulator cannot connect to the localhost.
io.ktor.client.engine.darwin.DarwinHttpRequestException: Exception in http request: Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={NSErrorFailingURLStringKey=<ws://127.0.0.1:8080/websocket>, NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLKey=<ws://127.0.0.1:8080/websocket>}
Can anyone help me with this?
a

ayodele

04/12/2023, 9:35 AM
Can you link the setup you used??