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

Slavi

07/15/2021, 12:22 PM
Hello. Does ktor-server-kotlinMultiplatform support iOS? I guess only ktor-client supports it
b

Big Chungus

07/15/2021, 12:47 PM
ktor server is jvm-only for now. There are plans to support native, but that's pending new native memory model
Why would you need a server on IOS, though? 😮
I'm genuinely curious
s

Slavi

07/15/2021, 12:51 PM
I’m using ktor as simple mock service. So my plan was to create libs for Android and iOS and include them as part of apps (already done so for android). Then it could be used to begin development faster (before real backend is ready) or special demo mode for new users
I’m a mobile developer, so my use cases are quite… specific 😏
Thanks for your answers. In this case I’ll just deploy ktor app to my cloud server
a

alex009

07/15/2021, 1:36 PM
@Slavi maybe you just use ktor-client-mock solution? 🙂
s

Slavi

07/15/2021, 1:41 PM
Thanks for suggestion. However it looks more like a simple interceptor which I could write by myself in retrofit interceptor. I wrote quite powerful mocks which store results, handle most of business logic. I’m afraid client-testing won’t be as good and simple as ktor-server for dozens of various requests and thousands of lines of code
n

nschulzke

07/15/2021, 3:12 PM
Is there a reason you can't host the mock in the cloud? If you did that, the only change your app would need to migrate to the real server is a change of the base URL, rather than needing to delete a whole embedded web server. Meanwhile, your testing would be more indicative of how it will actually work, since the app isn't just connecting to localhost.
s

Slavi

07/15/2021, 3:20 PM
It doesn’t need any url when embedded into the app. I’m using ktor test methods to supply arguments and get response. So it’s not a server in fact, just some code that is being constantly tested 😂 When you deploy in clouds you need a special mechanism that would allow you not to create side effects for other users that use these mocks atm. I’m using database to keep results of actions, thus using the same profile will add history entries, change status of this profile for other colleagues. Anonymous sessions or something like that. Keeping everything on device is better
2 Views