user11901195
user11901195

Reputation:

Is there a WebSocket client library for iOS when using Kotlin?

I am looking for a WebSocket library that I can use in a Kotlin Multiplatform project for my iOS implementation. This project is currently in IntelliJ and I am using Gradle to manage dependencies.

I have not been able to find a library that supports iOS and that I can specifically pull into my project via Gradle.

The likes of Starscream, Socket.io, SocketRocket etc seem to only have a means of importing dependencies within Xcode/CocaoPods and nothing via Gradle for my IntelliJ project.

To give some more context I have the following for my project

  1. Kotlin Common code for all my common functionality for the project
  2. Platform specific code for my WebSocket implementations for Java, JavaScript and iOS/Swift

The reason for the platform specific implementations is because I have not found a common library that supports WebSockets for all platforms.

Ktor comes close, but from what I see in their documentation their WebSocket client does not support iOS while their Http client supports all platforms.

If anyone has any recommendations that would be really helpful.

Upvotes: 4

Views: 1015

Answers (1)

Sérgio Eduardo
Sérgio Eduardo

Reputation: 81

The guys from ktor said that they are working on bringing Websockets to iOS but it's still a few months from release. I haven't tried it yet but you can import cocoapods to an multiplatform project so maybe you can use it that way, but note that it will only compile in xcode.

Also you should join kotlinlang on slack, the guys from jetbrains are really active there and will usually have an answer in a day.

Upvotes: 3

Related Questions