Skip to content

Commit 06b1e6e

Browse files
committed
improvements based on revivew
1 parent 6cab550 commit 06b1e6e

File tree

1 file changed

+33
-37
lines changed

1 file changed

+33
-37
lines changed

src/pages/docs/guides/chat/build-task-oriented.mdx

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ meta_keywords: "task-oriented chat, 1:1 chat, small group chat, realtime messagi
66

77
Ably Chat is purpose-built for task-oriented chat experiences, from 1:1 conversations to small group interactions that enhance specific activities and workflows.
88

9-
> If you need to deliver seamless, contextual chat experiences that enhance tasks like support tickets, deliveries, gaming sessions, collaborative work, or transactional processes, without sacrificing performance, reliability, or costs, then Ably is the proven choice.
9+
If you need to deliver seamless, contextual chat experiences that enhance tasks like support tickets, deliveries, gaming sessions, collaborative work, or transactional processes, without sacrificing performance, reliability, or costs, then Ably is the proven choice.
1010

1111
Building with Ably means that you no longer need to worry about managing websocket servers, handling failover, network disruptions, or keeping latency low. Ably handles all of this for you, leaving you free to focus on creating engaging task-oriented experiences.
1212

@@ -46,26 +46,25 @@ For large-scale chat scenarios with many users per room, see our [building lives
4646

4747
Each room includes all task participants: customers and agents in support, buyers and sellers in marketplaces, players in games, team members in projects. Participants can join and leave as the task evolves. Access to message history and other features can be granted to all or select participants via capabilities.
4848

49-
## Message throughput and rate management
49+
Key considerations for task-oriented chat rooms:
50+
- When will the room be joined by participants and how will it be linked to the task (delivery, support ticket, game session and so on)?
51+
- For something like support, you could create a ticket when the user opens the chat window in the UI and perhaps provides a name or category for the request. First create a support ticket, and also deliver a token for authentication and room name for the user to join.
52+
- For games it can be one room per game session (such as a chess game), or for a MMORPG, each quest or location could be allocated a room.
53+
- For deliveries, appointments, calls, there is usually a clear 1:1 mapping of task to room, and typically users join the room when they join the task.
54+
- Does the room have to be active for the whole duration of the task, or just sometimes?
55+
- Only attaching to rooms when they are needed is more cost-effective and saves resources.
56+
- For example, during a delivery, the chat room doesn't always have to be active. With a good strategy for push notifications to alert inactive users of new messages, they can attach for very short periods of time for each delivery.
57+
- Do you need any spam prevention measures applied before allowing users to join rooms?
58+
- For example, in a support chat scenario, you could add a captcha or other measures before creating a new ticket and issuing a token that allows the user to join the room for that ticket.
59+
- Do you need long-term archiving of the chat history?
60+
- Check out the guide for [exporting chat data](/docs/guides/chat/export-chat) for an overview of your options.
5061

51-
In task-oriented chat, each room is typically low throughput. Scaling comes by running as many rooms as you need at the same time. Ably handles everything from 1:1 conversations and small group discussions to [livestream chats](/docs/guides/chat/build-livestream) with the same reliability and scalability guarantees.
52-
53-
Chat rooms scale horizontally. Ably allows you to have as many rooms as you need running in parallel.
54-
55-
* **Proven at scale:** Ably delivers over 500 million messages per day for customers.
56-
* **Rate limiting:** Prevent spam and maintain conversation quality with global or per-user throttling appropriate for your use case.
5762

5863
## Authentication
5964

6065
Authentication is a design decision.
6166

62-
In some cases, you'll want to tie participants to their identity in your application.
63-
In others, anyone can join and participate.
64-
Ably Chat supports both of these scenarios - you don't need to go through the hassle of setting up
65-
users in Ably and trying to keep them in sync with your application. Every client has a `clientId`.
66-
If you want to allow random users, just use a random string. If you want to tie it to your application,
67-
then use the ID of the user or some other well-known identifier. Just make sure you can tell them apart if
68-
you allow both at the same time, for example by using distinct prefixes.
67+
In some cases, you'll want to tie participants to their identity in your application. In others, anyone can join and participate. Ably Chat supports both of these scenarios - you don't need to go through the hassle of setting up users in Ably and trying to keep them in sync with your application. Every client has a `clientId`. If you want to allow random users, just use a random string. If you want to tie it to your application, then use the ID of the user or some other well-known identifier. Just make sure you can tell them apart if you allow both at the same time, for example by using distinct prefixes.
6968

7069
<Code>
7170
```javascript
@@ -131,6 +130,9 @@ const { unsubscribe } = room.presence.subscribe((event) => {
131130
console.log('Present members:', presentMembers);
132131
});
133132

133+
// attach the room
134+
await room.attach();
135+
134136
// join presence
135137
await room.presence.enter({ status: 'available' });
136138

@@ -159,6 +161,9 @@ room.typing.subscribe((event) => {
159161
console.log('Currently typing:', event.currentlyTyping);
160162
});
161163

164+
// attach the room
165+
await room.attach();
166+
162167
// show a typing indicator (call on every keystroke, Ably Chat SDKs throttle this to a predefined interval)
163168
await room.typing.keystroke();
164169

@@ -215,6 +220,9 @@ const subscription = room.messages.subscribe((messageEvent) => {
215220
// handle message event to update state and UI
216221
});
217222

223+
// attach the room
224+
await room.attach();
225+
218226
// Load recent history for context
219227
// This ensures you get a complete picture without missing messages
220228
let historyResponse = await subscription.historyBeforeSubscription({limit: 50});
@@ -239,7 +247,7 @@ See the [React UI Kit](/docs/chat/react-ui-kit) for more details.
239247

240248
Ably's comprehensive platform enables you to combine chat with other realtime features to create rich, interactive task experiences.
241249

242-
**Pub/Sub channels** add interactive elements:
250+
**Pub/Sub channels** enable you to build rich, interactive task experiences:
243251
- **Live polls:** Quick feedback during collaborative decisions.
244252
- **Status updates:** Real-time progress indicators for tasks.
245253
- **Interactive ratings:** Instant feedback collection.
@@ -254,7 +262,7 @@ Effective moderation ensures your task-oriented chats remain professional, safe,
254262
Ably supports [moderating messages](/docs/chat/moderation) both before and after publication, making it easy to integrate with AI-powered or human moderation systems.
255263

256264
* **After-publish moderation:** Messages appear instantly, then are removed if flagged as inappropriate.
257-
Best for most task-oriented scenarios, where immediacy often matters. It can be used to detect abusive behaviour or inappropriate content after the fact, and can also be used to remove users if necessary.
265+
Best for most task-oriented scenarios, where immediacy often matters. It can be used to detect abusive behaviour or inappropriate content after the fact.
258266
* **Before-publish moderation:** Messages are held until approved. Use this for high-stakes tasks where every message must be vetted.
259267

260268
### Key moderation considerations for task-oriented chat
@@ -279,7 +287,7 @@ Best for most task-oriented scenarios, where immediacy often matters. It can be
279287

280288
Ably's flexible moderation system adapts to your task requirements:
281289

282-
* **Per-room policies:** Different moderation rules for different task types or user roles.
290+
* **Per-room policies:** Different moderation rules for different task rooms.
283291
* **Fallback handling:** Configure what happens when moderation services are unavailable.
284292
* **Custom integration:** Connect your existing moderation infrastructure via webhooks, serverless functions, or message queues.
285293
* **Role-based permissions:** Give moderators special capabilities to manage conversations.
@@ -306,7 +314,7 @@ room.messages.send({text: 'Can you help me with my order?'}).then((message) => {
306314

307315
AI chatbots are revolutionizing the way we interact with digital platforms. Integrating AI functionality into your chat experience can provide automated contextual moderation, personalized interactions, automatically creating training material, and more.
308316

309-
Ably's flexible [integration capabilities](/docs/platform/integrations) make it easy to connect your chat system with AI services. Through Ably's integrations, you can automatically route messages to:
317+
Ably's flexible [integration capabilities](/docs/chat/integrations) make it easy to connect your chat system with AI services. Through Ably's integrations, you can automatically route messages to:
310318

311319
* Serverless functions (AWS Lambda, Azure Functions, and others).
312320
* Event streaming services including Kafka, SQS and Pulsar.
@@ -320,11 +328,7 @@ This enables powerful AI features like:
320328
* Chat summarization and key point extraction.
321329
* Automatically adding contextual information for your agents to help them be more effective.
322330

323-
For example, you could set up an integration that sends all messages from each chat room to an AI service for sentiment analysis,
324-
which then automatically flags detected negative customer sentiments for review, to ensure they are handled appropriately, which
325-
could increase overall customer satisfaction.
326-
Or route messages to a language model to generate contextual responses to common questions, or to pull relevant information
327-
for your agent to increase their effectiveness in handling support queries.
331+
For example, you could set up an integration that sends all messages from each chat room to an AI service for sentiment analysis, which then automatically flags detected negative customer sentiments for review, to ensure they are handled appropriately, which could increase overall customer satisfaction. Or route messages to a language model to generate contextual responses to common questions, or to pull relevant information for your agent to increase their effectiveness in handling support queries.
328332

329333
## Room reactions
330334

@@ -346,16 +350,9 @@ await room.reactions.send({name: '👍'});
346350

347351
Network disruption happens - mobile internet loses signal or someone drives through a tunnel. All of Ably's SDKs are designed with this in mind, so that you don't have to handle complicated reconnection logic.
348352

349-
Every SDK instance keeps track of where it's at in the message stream. If the connection is lost, the library will
350-
[automatically attempt to reconnect](/docs/platform/architecture/connection-recovery) to the servers and in
351-
doing so, resume its position in the stream. This enables the chat to continue as if the user never left.
352-
After extended periods of disconnection, the client can make use of [history](#history) to backfill missing messages.
353+
Every SDK instance keeps track of where it's at in the message stream. If the connection is lost, the library will [automatically attempt to reconnect](/docs/platform/architecture/connection-recovery) to the servers and in doing so, resume its position in the stream. This enables the chat to continue as if the user never left. After extended periods of disconnection, the client can make use of [history](#history) to backfill missing messages.
353354

354-
It's incredibly rare, but sometimes a client might lose connection to a particular data center. Ably operates in multiple data centers around
355-
the world with multiple fallback regions available. If a client can't reach the nearest data center, it will try the next one until the
356-
connection is re-established, ensuring minimal downtime and that network issues don't disrupt the experience that you are trying to build.
357-
Ably's [fault tolerance guide](/docs/platform/architecture/fault-tolerance) describes how we do this and that, even if an entire region
358-
goes down, it has little-to-no impact on the global service and your application.
355+
It's incredibly rare, but sometimes a client might lose connection to a particular data center. Ably operates in multiple data centers around the world with multiple fallback regions available. If a client can't reach the nearest data center, it will try the next one until the connection is re-established, ensuring minimal downtime and that network issues don't disrupt the experience that you are trying to build. Ably's [fault tolerance guide](/docs/platform/architecture/fault-tolerance) describes how we do this and shows that even if an entire region goes down, it has little-to-no impact on the global service and your application.
359356

360357
## Priced for task-oriented efficiency
361358

@@ -400,10 +397,9 @@ Before you go live with your task-oriented chat, review these key points:
400397

401398
* **Authentication strategy:** Ensure you're using token authentication for all client-side communication with appropriate JWT expiration times for your task duration.
402399
* **Permission model:** Apply the principle of least privilege - participants should only have access to their specific task rooms and relevant capabilities.
403-
* **Performance tuning:** Validate your message rate and batching configuration based on your typical task conversation patterns.
404400
* **Monitoring setup:** Monitor task room activity, message delivery success rates, and connection stability across your user base.
405-
* **Scale planning:** Confirm you are on the right Ably package for your expected task volume and user concurrency.
406-
* **Error handling:** Implement proper error handling for network disruptions and ensure graceful degradation when tasks are interrupted.
401+
* **Scale planning:** Confirm you are on the right Ably package for your expected volume.
402+
* **Error handling:** Implement proper error handling for network disruptions and ensure graceful degradation when network connections are interrupted.
407403
* **Data retention:** Verify your message history retention policy aligns with your task lifecycle and any compliance requirements.
408404
* **Integration testing:** Test all third-party integrations (AI services, moderation, external APIs) under realistic task scenarios.
409405

@@ -412,7 +408,7 @@ Before you go live with your task-oriented chat, review these key points:
412408
* **Explore Ably Chat:** Dive into the [Ably Chat documentation](/docs/chat) for comprehensive API details and advanced features.
413409
* **Try the examples:** Play around with [task-oriented chat examples](/examples?product=chat) to see real implementations.
414410
* **Get started quickly:** Follow the [JavaScript/TypeScript](/docs/chat/getting-started/javascript) or [React](/docs/chat/getting-started/react) getting started guides.
415-
* **Add intelligence:** Learn how to integrate [AI assistance](/docs/platform/integrations) for smarter task experiences.
411+
* **Add intelligence:** Learn how to integrate [AI assistance](/docs/chat/integrations) for smarter task experiences.
416412
* **Secure your chats:** Understand [token authentication](/docs/auth/token#jwt) for production-ready security.
417413
* **Moderate effectively:** Implement [chat moderation](/docs/chat/moderation) tailored to your task scenarios.
418414
* **Scale with confidence:** Explore [server-side batching](/docs/messages/batch#server-side) for optimal performance.

0 commit comments

Comments
 (0)