---
title: "Subscribe to Livechat Room (Realtime)"
slug: "subscribe-to-livechat-room-realtime"
updated: 2024-12-04T10:45:10Z
published: 2024-12-04T10:45:10Z
---

> ## 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.

# Subscribe to Livechat Room (Realtime)

## Subscribe

This is the room messages stream. You need the room ID to subscribe.

### DDP message

```json
{
    "msg":"sub",
    "id":"6NctZomXL3ZdtKNsn",
    "name":"stream-livechat-room",
    "params":[
        "KTZqPAR9DQGxKcxzf",
        {
            "useCollection":false,
            "args":[
                {
                    "token":"jkGaw6duhiuh45"
                }
            ]
        }
    ]
};
```

### Sample response

```json
{
    "msg":"ready",
    "subs":[
        "JHalkajwdh67"
    ]
j
```

## Unsubscribe

To unsubscribe from a room, send "unsub", along with the ID of the previous subscribe message.

```json
{
    "msg": "unsub",
    "id": "unique-id",
}
```

If you want to subscribe to a user's messages stream, pass `__my_messages__` as the room ID.
