Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHAT-254] Add chat design pattern for message storage #2245

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

m-hulbert
Copy link
Contributor

Description

This PR adds a design pattern for how to store messages outside of Ably in relation to the Chat SDK.

@m-hulbert m-hulbert self-assigned this Aug 20, 2024
@ably-ci ably-ci temporarily deployed to ably-docs-chat-254-stor-d2qfxu August 20, 2024 08:31 Inactive
Copy link
Member

@Srushtika Srushtika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @m-hulbert, added a few suggestions!

- javascript
---

Use of room "history":/chat/rooms/history enables you to retrieve messages stored by Ably from between 72 hours, up to 30 days. In some instances you may wish to store messages for longer than this, or you would prefer to store all messages in your own database.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's skip the "longer than this" narrative and only keep it about the preference to use their own DB. Perhaps we can add a CTA to raise a feature request if they'd like to enable storage for longer than 30 days.


The motivation for storing messages externally could be for various reasons, such as:

* For privacy reasons.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* For privacy reasons.
* For privacy and compliance reasons.


* For privacy reasons.
* The need to analyze the historic data that users send.
* So that messages are available for moderation, review or audit purposes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is covered in the analyze point above.

* For privacy reasons.
* The need to analyze the historic data that users send.
* So that messages are available for moderation, review or audit purposes.
* When you require storage longer than 30 days.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's skip this per above.

* So that messages are available for moderation, review or audit purposes.
* When you require storage longer than 30 days.

Storing message history outside of Ably can be achieved using "Ably Pub/Sub":/products/channels and its integrations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should say that it can be achieved using the integrations but in the beta stage, those integrations will have to be configured with the channels which are the pub/sub primitives behind chat features in a room.


The Chat SDK is built upon the functionality provided by "Ably Pub/Sub":/products/channels. The Chat SDK is built so that you don't need to interact with some of the lower-level features provided by Pub/Sub. It is therefore possible to utilize the Pub/Sub SDK to provide functionality to your chat applications that isn't yet available as an abstraction in the Chat SDK.

You need to understand that a room is based on one or more Pub/Sub "channels":/channels. The number of channels depends on the chat features enabled for that room. For storage purposes, you need to manage the channel for regular chat messages, and the channel for room reactions if you want to store those.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You need to understand that a room is based on one or more Pub/Sub "channels":/channels. The number of channels depends on the chat features enabled for that room. For storage purposes, you need to manage the channel for regular chat messages, and the channel for room reactions if you want to store those.
Behind-the-scenes, a chat room is based on one or more Pub/Sub "channels":/channels. For storage purposes, you may need to access the channel used for regular chat messages, and the channel for room reactions if you want to store those.

@@ -0,0 +1,190 @@
---
title: Message storage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given we are talking generally about all integrations, I think we should keep this title generic too. wdyt @m-hulbert?


Integrations all work on a rule based system, where rules can be configured to run for every message published to a channel. For chat messages, you will need to utilize a function to parse the messages sent to the integration that transforms them into a format suitable to storage in your database.

h3(#create-rule). Create an integration rule
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A screenshot might go a long way in this section, wdyt @m-hulbert ?

@m-hulbert m-hulbert marked this pull request as draft September 12, 2024 11:59
@m-hulbert m-hulbert marked this pull request as draft September 12, 2024 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants