https://github.com/animatedledstrip/client-kotlin-mpp
Library for connecting to an AnimatedLEDStrip server from clients written in Kotlin/JVM or Kotlin/JS
https://github.com/animatedledstrip/client-kotlin-mpp
als-client-library als-library
Last synced: 12 months ago
JSON representation
Library for connecting to an AnimatedLEDStrip server from clients written in Kotlin/JVM or Kotlin/JS
- Host: GitHub
- URL: https://github.com/animatedledstrip/client-kotlin-mpp
- Owner: AnimatedLEDStrip
- License: mit
- Created: 2020-07-19T00:18:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-24T17:59:21.000Z (about 2 years ago)
- Last Synced: 2025-04-03T10:37:53.954Z (about 1 year ago)
- Topics: als-client-library, als-library
- Language: Kotlin
- Homepage:
- Size: 304 KB
- Stars: 3
- Watchers: 0
- Forks: 2
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/AnimatedLEDStrip/client-kotlin-mpp/actions/workflows/test.yml)
[](https://codecov.io/gh/AnimatedLEDStrip/client-kotlin-mpp)
[](https://maven-badges.herokuapp.com/maven-central/io.github.animatedledstrip/animatedledstrip-client)
# AnimatedLEDStrip Client Library for Kotlin/MPP
This library allows a Kotlin/JVM or Kotlin/JS client to communicate with an AnimatedLEDStrip server.
## Creating an `ALSHttpClient`
To create a HTTP client, run `ALSHttpClient(clientEngine, ip)`.
> `clientEngine` is a [Ktor `HttpClientEngineFactory`](https://ktor.io/docs/http-client-engines.html)
```kotlin
val client = ALSHttpClient(CIO, ip = "10.0.0.254")
```
An optional configuration for the Ktor engine can be passed as a third argument.
Any configuration should include a JSON feature that uses the AnimatedLEDStrip serializer:
```kotlin
import animatedledstrip.communication.serializer as alsSerializer
install(JsonFeature) {
serializer = KotlinxSerializer(alsSerializer)
}
```
## Communicating with the Server
This library follows the conventions laid out for [AnimatedLEDStrip client libraries](https://animatedledstrip.github.io/client-libraries).