Skip to content

Simple cross-platform chat in Kotlin with real-time communication via WebSocket. Uses Compose, OkHttp, and Gson to provide a consistent chat experience on both Desktop and Android.

License

Notifications You must be signed in to change notification settings

eduardomcb/simple-chat-multiplatform

Repository files navigation

Para documentação em português, consulte o README em Português.

Cross-Platform Chat in Kotlin

This is a cross-platform chat project in Kotlin that utilizes Compose to create user interfaces for desktop and Android, OkHttp for communication with a WebSocket server, and Gson for message serialization.

Features

  • Cross-platform support for Desktop and Android.
  • Real-time communication through a WebSocket server.
  • Message serialization and deserialization using Gson.
  • Simple and elegant user interface created with Compose.
demo.mp4

How to Use

Prerequisites

  • Make sure you have Android Studio or IntelliJ IDEA set up with Kotlin and Compose dependencies.

Setup

  1. Clone the repository:

    git clone https://github.com/eduardomcb/simple-chat-multiplatform.git
    cd simple-chat-multiplatform
  2. Open the project in your development environment.

  3. Build and run the application in your desired environment (Desktop or Android).

Run your application

On desktop

To run your desktop application in Android Studio, select desktopApp in the list of run configurations and click Run:


You can also run Gradle tasks in the terminal:

  • ./gradlew run to run application
  • ./gradlew package to store native distribution into build/compose/binaries

On Android

To run your application on an Android emulator:

  1. Ensure you have an Android virtual device available. Otherwise, create one.

  2. In the list of run configurations, select androidApp.

  3. Choose your virtual device and click Run:


Alternatively, use Gradle

To install an Android application on a real Android device or an emulator, run ./gradlew installDebug in the terminal.

WebSocket Server

This chat project depends on a WebSocket server to function. You can find the source code for the WebSocket server in Node.js in the following repository:

simple-chat-server

Make sure to set up and run the WebSocket server before starting the chat application.

Contributions

If you'd like to contribute to this project, feel free to create pull requests or report issues in the Issues section.

License

This project is licensed under the MIT License - see the LICENSE file