Skip to content

Example of ktor implementation for sse (server-sent events) in KMM project. With demo server that emits sse events.

Notifications You must be signed in to change notification settings

JurajBegovac/ktor-kmm-sse

Repository files navigation

ktor-kmm-sse

Example of ktor implementation for sse (server-sent events) in KMM project. With demo server that emits sse events.

Setup

  1. Find local.properties file in project root folder. If not present add it.

  2. Add your ip address to local.properties. Something like this (where xxx.xxx.x.xxx is your ip address):

## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=BLABLABALA # generated by Android studio
ip.address=xxx.xxx.x.xxx # <--------------------------- ADD THIS !!!!
  1. Build project

  2. Run backend application (:backend -> Server.kt)

  3. Run Android or iOS app

Modules

  1. backend -> contains demo server that emits sse events (ktor server)

  2. shared -> contains ktor client implementation for sse event & common code for iOS/Android apps

  3. shared-models -> contains constants and models that are shared between backend and mobile apps (e.g. SseEvent model)

  4. androidApp -> Android app code

  5. iosApp -> iOS app code

About

Example of ktor implementation for sse (server-sent events) in KMM project. With demo server that emits sse events.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published