---
title: "Realtime API"
slug: "realtimeapi"
updated: 2026-05-14T19:25:03Z
published: 2026-05-14T21:41:09Z
canonical: "developer.rocket.chat/realtimeapi"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://developer.rocket.chat/llms.txt
> Use this file to discover all available pages before exploring further.

# Realtime API

The Rocket.Chat real-time API allows developers to integrate Rocket.Chat’s real-time messaging and collaboration features in their applications. It utilizes WebSockets, a technology that enables real-time communication between a client (your application) and the Rocket.Chat server. By leveraging this API, you can create dynamic, interactive experiences within your application, enabling users to send and receive messages, participate in live chats, and access various collaboration features.

To get started with the Rocket.Chat real-time API, point your client to the WebSocket of the server you want to connect to:

```plaintext
wss://[ABC.DOMAIN.COM]/websocket
```

> For localhost, use `ws://localhost:3000/websocket.`

The API encompasses two integral components: [Method Calls](/v1-api/apidocs/realtime-method-calls) and [Subscriptions](/v1/docs/subscriptions), which are seamlessly supported within the WebSocket connection.

To ensure streamlined functionality within a single connection, we leverage RPC (Remote Procedure Call) using the following format:

```json
{
    "msg": "type-of-communication",
    "id": "unique-id",
    ... // per call defined data
}
```

The `type-of-communication` is defined based on its purpose:

- [Method Calls](/v1-api/apidocs/realtime-method-calls): `method`
- [Subscriptions](/reference/api/realtime-api/subscriptions): `sub`

> [!WARNING]
> ⚠️ **Warning: Deprecated**
> 
> The [Method Calls](/v1-api/apidocs/realtime-method-calls) are deprecated. We are no longer actively testing or maintaining these methods, and their behavior may be unreliable or change without notice. For new development and long-term support, we strongly recommend using the REST APIs instead. Avoid relying on DDP methods for critical functionality.

## Connect to the WebSocket

Before requesting any method calls and subscriptions, you must send a connect message. This connect message is an initial step to establish the connection and prepare for subsequent requests.

```json
{
    "msg": "connect",
    "version": "1",
    "support": ["1"]
}
```

> [!NOTE]
> The server periodically sends a `ping` message, and it's essential to respond with a `pong` message to maintain the connection. Failure to respond appropriately will result in the server closing the connection.

```json
{
    "msg": "pong"
}
```

## Resources

- [rocketchat-ddp-listener](https://github.com/JSzaszvari/rocketchat-ddp-listener): A basic example script that uses the 'ddp' NodeJS package to subscribe to the real-time API stream of a Group/Channel.
- [Rocket.Chat.RealTime.API.RxJS](https://github.com/inf3cti0n95/Rocket.Chat.RealTime.API.RxJS): Abstraction for utilizing Rocket.Chat's real-time API Methods with [RxJS](http://reactivex.io/rxjs/).
- [rocketchat-async](https://github.com/hynek-urban/rocketchat-async): asyncio-based Python wrapper for the Rocket.Chat real-time API.
