https://github.com/lepicekmichal/signalrkore
A Kotlin multiplatform coroutine-based SignalR client.
https://github.com/lepicekmichal/signalrkore
android client coroutines ios js jvm kotlin multiplatform multiplatform-kotlin-library signalr signalr-client signalr-core web-socket websocket
Last synced: about 1 month ago
JSON representation
A Kotlin multiplatform coroutine-based SignalR client.
- Host: GitHub
- URL: https://github.com/lepicekmichal/signalrkore
- Owner: lepicekmichal
- License: apache-2.0
- Created: 2022-11-17T19:14:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-13T16:55:40.000Z (about 1 month ago)
- Last Synced: 2025-09-13T18:42:06.930Z (about 1 month ago)
- Topics: android, client, coroutines, ios, js, jvm, kotlin, multiplatform, multiplatform-kotlin-library, signalr, signalr-client, signalr-core, web-socket, websocket
- Language: Kotlin
- Homepage:
- Size: 827 KB
- Stars: 43
- Watchers: 7
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# SignalRKore
[](https://mvnrepository.com/artifact/eu.lepicekmichal.signalrkore)
[](http://kotlinlang.org)
[](http://www.apache.org/licenses/LICENSE-2.0)
[](https://mailchi.mp/kotlinweekly/kotlin-weekly-416)

## Overview
SignalRKore is a Kotlin Multiplatform client library for ASP.NET Core SignalR. It enables real-time communication between clients and servers, allowing server-side code to push content to clients and vice-versa instantly.
## Why should you use **this** library
| | [Official client library](https://learn.microsoft.com/en-us/aspnet/core/signalr/java-client) | SignalRKore |
|:---------------------------|:--------------------------------------------------------------------------------------------:|:-----------------------------------:|
| Written in | Java | Kotlin |
| KMM / KMP | :heavy_multiplication_x: | Android, JVM, iOS |
| Network | OkHttp only | Ktor |
| Async | RxJava | Coroutines |
| Serialization | Gson (non-customizable) | Kotlinx Serializable (customizable) |
| Streams | :heavy_check_mark: | :heavy_check_mark: |
| Transport fallback | :heavy_multiplication_x: | :heavy_multiplication_x: |
| Automatic reconnect | :heavy_multiplication_x: | :heavy_check_mark: |
| SSE | :heavy_multiplication_x: | :heavy_check_mark: |
| Connection status | :heavy_multiplication_x: | :heavy_check_mark: |
| Logging | SLF4J | Custom interface |
| MsgPack | :heavy_check_mark: | :heavy_multiplication_x: |
| Tested by time & community | :heavy_check_mark: | :heavy_multiplication_x: |## Quick Example
```kotlin
// Create a connection
val connection = HubConnectionBuilder.create("http://localhost:5000/chat")// Start the connection
connection.start()// Send a message to the server
connection.send("broadcastMessage", "User", "Hello, SignalR!")// Receive messages from the server
connection.on("broadcastMessage", String.serializer(), String.serializer()).collect { (user, message) ->
println("$user says: $message")
}// Don't forget to stop the connection when done
connection.stop()
```## How to use
Please see the [documentation](https://lepicekmichal.github.io/SignalRKore/).
## Acknowledgments
All functionality was possible to implement only thanks to [AzureSignalR ChatRoomLocal sample](https://github.com/aspnet/AzureSignalR-samples/tree/main/samples/ChatRoomLocal).
## License
SignalRKore is released under the [Apache 2.0 license](https://github.com/lepicekmichal/SignalRKore/blob/main/LICENSE.txt).
## TODO list
- [x] Readme
- [x] Documentation
- [ ] Add example project
- [x] Fix up ServerSentEvents' http client
- [x] Add logging
- [ ] Error handling
- [ ] Add tests
- [x] Implement streams
- [x] Extend to JVM
- [x] Extend to iOS
- [ ] Implement transport fallback
- [x] Implement automatic reconnect
- [ ] Reacting to stream invocation from server