You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update demo to match Next.js and Chat SDK best practices
Moved demo to latest Chat SDK
Replace outdated Next.js patterns
- Remove dynamic + ssr: false from app/page.js and replace with a direct import
- Move Ably client creation into useEffect + useState in components/Chat.jsx to prevent new connections on every render
- Add cleanup function that closes the Ably realtime connection on unmount
- Migrate from next/head to the Next.js Metadata API
Update README to reflect Ably Chat SDK usage, correct Node version, and fix outdated descriptions
Copy file name to clipboardExpand all lines: README.md
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,4 @@
1
-
> [!IMPORTANT]
2
-
> This repository uses the Ably Pub/Sub approach for building chat apps. We now offer Ably Chat—a new family of SDKs and APIs that streamline development and manage realtime chat complexity for you. For a modern, easier way to create chat experiences, visit our [Ably Chat documentation](https://ably.com/docs/chat).
3
-
4
-
# Building a Realtime Chat App with Next.js, Ably, and Vercel
1
+
# Building a realtime chat app with Next.js, Ably Chat, and Vercel
5
2
6
3
Live example at: <https://next-js-chat-app.vercel.app>
7
4
@@ -13,8 +10,8 @@ This is a demo chat application with [Next.js](https://nextjs.org/) using [Ably]
13
10
14
11
It demonstrates the use of:
15
12
16
-
-Pub/sub messaging
17
-
- Ably's React Hooks
13
+
-[Ably Chat SDK](https://github.com/ably/ably-chat-js) for messaging
@@ -23,7 +20,7 @@ The project uses the following components:
23
20
24
21
-[Next.js](https://nextjs.org/) is a React framework from [Vercel](https://vercel.com/). It is used to build static web applications with server side rendering, serverless functions and seamless hosting. It's a framework that takes the React knowledge you already have, and puts some structure and conventions in place.
25
22
26
-
-[Ably](https://ably.com/) is realtime, pub/sub messaging platform with a suite of integrated services to deliver complete realtime functionality directly to end-users.
23
+
-[Ably Chat](https://ably.com/docs/chat) is a set of SDKs built on top of Ably's realtime platform, designed for building chat experiences with minimal setup.
27
24
28
25
-[Vercel](https://vercel.com/) is a hosting platform, built from the ground up to host Next.js apps, and Serverless Functions with them.
29
26
@@ -34,7 +31,7 @@ The project uses the following components:
34
31

35
32
*The UI of the app we'll build with this walkthrough*
36
33
37
-
We'll build a realtime chat app that runs in the browser. It will be built upon the Next.js [create-next-app](https://nextjs.org/docs/api-reference/create-next-app) template, it will contain a React component which will use Ably to send and receive messages. We'll also write a Next.js serverless function which will be used to connect to Ably.
34
+
We'll build a realtime chat app that runs in the browser. It will be built upon the Next.js [create-next-app](https://nextjs.org/docs/api-reference/create-next-app) template, it will contain a React component which will use the Ably Chat SDK to send and receive messages. We'll also write a Next.js [Route Handler](https://nextjs.org/docs/app/building-your-application/routing/route-handlers) which will be used to authenticate with Ably.
38
35
39
36
## Building & running locally
40
37
@@ -44,7 +41,7 @@ In order to build and deploy this app, you will need:
44
41
45
42
-**An Ably account** for sending messages: [Create an account with Ably for free](https://ably.com/signup).
46
43
-**A Vercel Account** for hosting on production: [Create an account with Vercel for free](https://vercel.com/signup).
47
-
-**Node 16** or greater: [Install Node](https://nodejs.org/en/).
44
+
-**Node 20** or greater: [Install Node](https://nodejs.org/en/).
48
45
49
46
You'll also need an API key from Ably to authenticate with the Ably Service. To get an API key, once you have [created an Ably account](https://ably.com/signup):
0 commit comments