Hey y'all, I'm playing around with Kotlin Native a...
# kotlin-native
s
Hey y'all, I'm playing around with Kotlin Native and running into some troubles. My current idea is to write a shared network client for an android & ios app. The API utilizes websockets, I guess my first question is, is that even possible? Can I use Ktor's websocket client on both platforms? native and jvm? I haven't found any details about this online. Currently, I'm just trying to get set up and import the ktor client into my project. I created a multiplatform project with the IntelliJ IDEA 2018.03 EAP wizard. All I basically did was adding the Ktor dependency (like shown in the KotlinConf app) and creating an instance of
HttpClient
in the common source folder. Compiling the jar works but when building for iOS I run into this error:
Copy code
./gradlew :kotlin-native-common:linkDebugFrameworkIos

....

> Task :kotlin-native-common:linkDebugFrameworkIos
kotlin-native-v2-common/src/commonMain/kotlin/com/sebchlan/chat/Chat.kt:3:8: error: unresolved reference: io
import io.ktor.client.HttpClient
       ^
kotlin-native-v2-common/src/commonMain/kotlin/com/sebchlan/chat/Chat.kt:8:15: error: unresolved reference: HttpClient
    val bla = HttpClient {
              ^
g
I’m not sure, but it looks strange that common module runs linkDebugFrameworkIos, looks like K/N platfrom specific task
Maybe you could share self contained example
o
IIRC ktor HTTP client on iOS doesn’t support websockets yet
s
yeah, somebody in #ktor told me that too
g
Sebastian, Donyou plan to open source it or just show some example? Would be very interesting to see your solution
o
Great news, would be truly cool is such MPP library be available for the public