Kotlin Phoenix
This project is aimed to allow developers to work with Phoenix Channels in Kotlin Multiplatform projects, and is composed of several modules:
- A modern Kotlin Multiplatform Phoenix Channels client, built with coroutines.
- Adapters designed for specific GraphQL clients (e.g. Apollo Client) allowing them to handle subscriptions via Phoenix Channels
As of now, this project is still experimental and should NOT be used in production. Please feel free to contribute and to share feedbacks and issues.
Modules
Installation
Add the mavenCentral
repository
// build.gradle.kts
repositories {
mavenCentral()
}
Add the kotlinphoenix
dependency in commonMain
source set.
// shared/build.gradle.kts
sourceSets {
val commonMain by getting {
dependencies {
implementation("io.github.ajacquierbret:kotlinphoenix-$moduleName:1.0.3")
}
}
}
Enable coroutines multithreading (required for iOS)
// gradle.properties
kotlin.native.binary.memoryModel=experimental
If some of your dependencies rely on coroutines, please force the dependency resolution to version 1.6.0-native-mt
with:
// shared/build.gradle.kts
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt") {
version {
strictly("1.6.0-native-mt")
}
}
OR :
// shared/build.gradle.kts
configurations {
all {
resolutionStrategy {
force("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-native-mt")
force("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0-native-mt")
}
}
}
Usage
See each module's documentation for example usages.
Roadmap
- Fork and re-design the JavaPhoenixClient library in order to build a Multiplatform library (at least iOS & Android), using
OkHttp
for Android andNSUrlSession
for iOS - Switch all the JavaPhoenixClient library callbacks to a coroutine based approach
- Publish this brand new library as Kotlin Phoenix Client on Github and Maven
- Create a PhoenixNetworkTransport adapter for Apollo Kotlin using Kotlin Phoenix Client, which will be available in the same repo, but inside another module.
- Clean both module's code and add detailed comment blocks
- Host Dokka generated API reference on Github Pages (API ref. is already generated by Dokka at
/dokka
, it just needs to go live) - Write and host proper documentation
- Mock a simple Phoenix server & test the Kotlin Phoenix library
- Encourage the community to contribute to the project
Contributing
I strongly believe that this library will be useful to a lot of Kotlin developers wishing to create engaging Phoenix Channels experiences on many platforms !
Any contribution, issue, feature request, feedback you make is greatly appreciated !
License
Distributed under the MIT License. See LICENSE for more information.
Acknowledgments
Huge thanks to these people, they helped a lot in many different ways:
- @dsrees – For the JavaPhoenixClient library on which this project is based.
- @martinbonnin and @BoD – For their golden advices and help building the project !