https://kotlinlang.org logo
v

vlad.minaev

08/02/2019, 12:59 PM
Are there any multiplatform libraries for seamless client-server communication (i.e. which abstracts from creating http endpoints and manual server querying)
d

Dominaezzz

08/02/2019, 1:23 PM
Ktor. Or do you mean like multiplatform retrofit?
v

vlad.minaev

08/02/2019, 1:24 PM
Probably something built on top of ktor or ktor plugin
d

Dominaezzz

08/02/2019, 1:25 PM
Probably not. You want http abstracted away? What exactly do you want this library or plugin to do?
v

vlad.minaev

08/02/2019, 1:26 PM
yep http/session management
instead of writing http endpoints you write service contract in common module, implement it in backend and call it on clients
I can even imagine borderless reactivity
d

Dominaezzz

08/02/2019, 1:28 PM
Ah I see. Kotlin doesn't have the machinery to create something like that yet.
Do you know any libraries that do this? (In other languages or smth).
v

vlad.minaev

08/02/2019, 1:30 PM
c

Casey Brooks

08/02/2019, 2:37 PM
OctoberCMS (PHP) does something like this to a large extent, too https://octobercms.com/
v

vlad.minaev

08/02/2019, 2:59 PM
why? doesn't look like something relevant, since PHP is backend only
g

gildor

08/02/2019, 3:12 PM
hmm, is it like gRPC?
there is no MPP gRPC implementation as I know, but it would be interesting project. Square’s Wire is good candidate for this (or at least first part), but it’s not cross platform
v

vlad.minaev

08/02/2019, 3:15 PM
it can be used as underlying transport/serialization
g

gildor

08/02/2019, 3:15 PM
actually, you probalby don’t need pure Kotlin implementation, gRPC already supported on JVM, JS and ObjC
so, all Kotlin platfroms are covered
it will defentely work on jVM with no problem, there are even a couple projects to generate Kotlin code with data classes and corouines, not sure tho how pleasant it use from JS and ObjC APIs
v

vlad.minaev

08/02/2019, 3:19 PM
I don't want to use it from js/objC. Say we have a project completely written on Kotlin
and instead of writing http api I just define some services on the backend which I can directly call from client
g

gildor

08/02/2019, 3:22 PM
What kind flavour of Kotlin? Anyway, if technology is not a problem there is a plenty of options, even just define OpenAPI spec and generate code And again gRPC imo the best option
v

vlad.minaev

08/02/2019, 3:23 PM
yep thats how things work nowadays
let's just talk about JS client (frontend)
if we create frontend on kotlin we can already use common data classes right ?
I feel it's better to come back with some sample project
d

Dominaezzz

08/02/2019, 6:20 PM
Yeah data classses should be fine.
3 Views