npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ably/chat

v1.3.0

Published

Ably Chat is a set of purpose-built APIs for a host of chat features enabling you to create 1:1, 1:Many, Many:1 and Many:Many chat rooms for any scale. It is designed to meet a wide range of chat use cases, such as livestreams, in-game communication, cust

Readme

Ably Chat Header npm version License

Ably Chat JavaScript, TypeScript and React SDK

Ably Chat is a set of purpose-built APIs for a host of chat features enabling you to create 1:1, 1:Many, Many:1 and Many:Many chat rooms for any scale. It is designed to meet a wide range of chat use cases, such as livestreams, in-game communication, customer support, or social interactions in SaaS products. Built on Ably's core service, it abstracts complex details to enable efficient chat architectures.


Getting started

Everything you need to get started with Ably:


Supported platforms

Ably aims to support a wide range of platforms. If you experience any compatibility issues, open an issue in the repository or contact Ably support.

This SDK supports the following platforms:

| Platform | Support | |--------------|---------| | Browsers | All major desktop and mobile browsers, including Chrome, Firefox, Edge, Safari (iOS/macOS), Opera, and Android. Internet Explorer is not supported. | | Node.js | Version 20 or newer. | | TypeScript | Fully supported, the library is written in TypeScript. | | React | Includes providers and hooks for deep integration with the React ecosystem. | | React Native | All React Native platforms. Issues can be reported or support requested. | | Android | Supported via the Ably Chat Kotlin SDK. | | iOS | Supported via the Ably Chat Swift SDK. |


Installation

The Chat SDK is built on top of the Ably Pub/Sub SDK and uses that to establish a connection with Ably.

JavaScript/React

Install the Pub/Sub SDK and the Chat SDK:

npm install ably @ably/chat

Usage

JavaScript / TypeScript

The following code connects to Ably's chat service, subscribes to a chat room, and sends a message to that room:

import * as Ably from 'ably';
import { ChatClient, RoomStatus, RoomStatusChange } from '@ably/chat';

// Initialize Ably Realtime client
// Note: For client-side applications, token authentication is recommended.
// See: https://ably.com/docs/auth
const realtimeClient = new Ably.Realtime({
  key: '<your-ably-api-key>',
  clientId: 'your-client-id',
});

// Create a chat client
const chatClient = new ChatClient(realtimeClient);

// Get a chat room
const room = await chatClient.rooms.get('my-room');

// Monitor room status
room.onStatusChange((statusChange: RoomStatusChange) => {
  switch (statusChange.current) {
    case RoomStatus.Attached:
      console.log('Room is attached');
      break;
    case RoomStatus.Detached:
      console.log('Room is detached');
      break;
    case RoomStatus.Failed:
      console.log('Room failed:', statusChange.error);
      break;
    default:
      console.log('Room status:', statusChange.current);
  }
});

// Subscribe to messages
const subscription = room.messages.subscribe((event) => {
  console.log('Received message:', event.message.text);
});

// Attach to the room
await room.attach();

// Send a message
await room.messages.send({ text: 'Hello, World!' });

React

For React applications, the SDK provides hooks and providers for seamless integration:

import * as Ably from 'ably';
import { ChatClient } from '@ably/chat';
import { ChatClientProvider, ChatRoomProvider, useMessages } from '@ably/chat/react';

// Initialize clients
// Note: For client-side applications, token authentication is recommended.
// See: https://ably.com/docs/auth
const realtimeClient = new Ably.Realtime({
  key: '<your-ably-api-key>',
  clientId: 'your-client-id',
});
const chatClient = new ChatClient(realtimeClient);

// Wrap your app with providers
function App() {
  return (
    <ChatClientProvider client={chatClient}>
      <ChatRoomProvider name="my-room">
        <ChatComponent />
      </ChatRoomProvider>
    </ChatClientProvider>
  );
}

// Use hooks to interact with chat
function ChatComponent() {
  const { sendMessage } = useMessages({
    listener: (event) => {
      console.log('Received message:', event.message.text);
    },
  });

  const handleSend = async () => {
    await sendMessage({ text: 'Hello, World!' });
  };

  return <button onClick={handleSend}>Send Message</button>;
}

Releases

The CHANGELOG.md contains details of the latest releases for this SDK. You can also view all Ably releases on changelog.ably.com.


Contribute

Read the CONTRIBUTING.md guidelines to contribute to Ably or Share feedback or request a new feature.


Support, feedback, and troubleshooting

For help or technical support, visit Ably's support page. You can also view the community reported Github issues or raise one yourself.