Skip to content

pubnub/kmp-chat

Folders and files

NameName
Last commit message
Last commit date
Jan 15, 2025
Jul 22, 2024
Jan 16, 2025
Jan 7, 2025
Nov 21, 2024
Jan 13, 2025
Jan 22, 2025
Jul 9, 2024
Jan 7, 2025
Nov 30, 2024
Jan 16, 2025
Jan 22, 2025
Jan 16, 2025
Jan 21, 2025
Jan 2, 2025
Dec 4, 2024
Jan 13, 2025
Sep 20, 2024
Jan 13, 2025
May 20, 2024
Jan 13, 2025
Dec 20, 2024
Dec 12, 2024
Sep 17, 2024
Jan 22, 2025
May 20, 2024
May 20, 2024
Dec 4, 2024

Repository files navigation

PubNub Kotlin Multiplatform Chat SDK

PubNub

Maven Central

Features

PubNub takes care of the infrastructure and APIs needed for the realtime communication layer of your application. Work on your app's logic and let PubNub handle sending and receiving data across the world in less than 100ms.

This SDK offers a set of handy methods to create your own feature-rich chat or add a chat to your existing application.

It exposes various PubNub APIs to Kotlin with twists:

  • Tailored specifically to the chat use case by offering easy-to-use methods that let you do exactly what you want, like startTyping() (a message) or join() (a channel).
  • Meant to be easy & intuitive to use as it focuses on features you would most likely build in your chat app, not PubNub APIs and all the technicalities behind them.
  • Offers new chat options, like quotes, threads, or read receipts, that let you build a full-fledged app quickly.

Get keys

You will need the publish and subscribe keys to authenticate your app. Get your keys from the Admin Portal.

Configure PubNub

  1. Integrate the Kotlin SDK into your project:

    • for Maven, add the following dependency in your pom.xml:

      <dependency>
         <groupId>com.pubnub</groupId>
         <artifactId>pubnub-chat</artifactId>
         <version>0.10.1</version>
      </dependency>
    • for Gradle, add the following dependency in your gradle.build:

      implementation ("com.pubnub:pubnub-chat:0.8.0")
  2. Configure your keys and create Chat instance:

        val chatConfig = ChatConfiguration(logLevel = LogLevel.DEBUG)
        val pnConfiguration =
            PNConfiguration.builder(userId = UserId("myUserId"), subscribeKey = "mySubscribeKey").build()
        var chat: Chat? = null
    
        Chat.init(chatConfig, pnConfiguration).async { result: Result<Chat> ->
            result.onSuccess { initializedChat: Chat ->
                println("Chat successfully initialized having logLevel: ${chatConfig.logLevel}")
                chat = initializedChat
            }.onFailure { exception: PubNubException ->
                println("Exception initialising chat: ${exception.message}")
            }
        }

Documentation

You'll find all the information about working with Kotlin Chat SDK in the official PubNub Kotlin Chat SDK documentation.

You'll find all the information about working with Swift Chat SDK in the official PubNub Swift Chat SDK documentation.

Support

If you need help or have a general question, contact [email protected].

License

This project is licensed under a custom MIT license. For more details about the license, refer to the License FAQ.