Skip to main content

Building chat

This guide will give you the resources and information you need to build messaging features into your app.

Before we begin, let's go over some terms we'll be using a lot in this article.

Channels

Channels are the backbone of building a chat experience with ChatKitty.

Direct channels are perfect for one-off conversations. We'll be using a direct channel to implement one-to-one chat.

Public and private channels are perfect for topic based conversations. They are also known as group channels. We'll be using them to implement group chat.

note

It is possible to create a direct channel with a single member.

Entering a chat

When a user starts a chat session and has no other active chat sessions in the session channel, the user has entered a chat. In other words, users who have entered a chat have at least one active chat session for that chat channel, and are active participants of the conversation. Active chat participants receive real-time messaging events, and are present to reply immediately.

Leaving a chat

After a user ends a chat session and has no other active chat sessions in the session channel, the user has left a chat. Users leave a chat when there is no longer at least one active chat session for that chat channel, and are no longer active participants of the conversation. After leaving a chat, users begin to get notifications of events that happened in the chat while they are away.

Leaving a channel

After a user joins a channel, the user becomes a channel member. Channel members can send messages in a channel, and receives messages and notifications related to the channel. If a user is no longer interested in a channel, the user can leave the channel and is no longer a channel member.

Okay, let's get started! 🏎️

Building one-to-one chat

Creating a direct channel

Create a direct channel using the Platform API or a client SDK.

Building one-to-one chat

Creating a group channel

Create a public or private channel using the Platform API or a client SDK.

Starting a chat session

As part of your chat screen initialization logic, start a chat session, passing the channel.

Sending messages

Send messages using the Platform API or a client SDK.

Listing previous messages

List messages using the Platform API or a client SDK.