A lightweight Kotlin multiplatform library that handles websocket connection. Uses Ktor websocket under the hood.
- Connection
- Reconnection retrials
- Good error handling
- Clean APIs
- Fast and light
- Multiplatform (iOS/Android)
Realtime is published on Github packages
Add the maven url to your build.gradle.kts
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Cherrio-LLC/RealTime")
credentials{
username = "Android"
password = "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"
}
}
}
Include the dependency. Latest version
implementation("github.cherrio:realtime-android:<version>")
You have to add the github token to your .netrc file on home directory like:
machine maven.pkg.github.com
login iOS
password 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
Add the source to your Podfile
source 'https://github.com/Cherrio-LLC/RealTimePodspec.git'
Then add
pod 'realtime', '~> 0.1.5'
Configure realtime on app initialization
Add the initialization to the onCreate of the class extending Application
override fun onCreate() {
super.onCreate()
Realtime.configureApp("baseUrl","UserId")
}
SwiftUi initialize in the struct extending App
init(){
RealtimeKt.configureApp(baseurl: "baseUrl", username: "iOS")
}
UIKit is different, you have to initialize in the AppDelegate on didFinishLaunchingWithOptions
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
RealtimeKt.configureApp(baseurl: "baseUrl", username: "iOS")
return true
}
Check the example apps
There's a lot of updates to come.
- Send generic data
- More tests
- Improve docs
Copyright 2022 Ayodele Kehinde
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.