# The chat of a live stream

`GET https://rest.wordplus.cloud/wordplus/realtime/streams/{name}/chat`

The last messages of the chat of a live stream, oldest first: 50, or `limit` up to 200. The chat keeps its last
200 messages for a day.

In the packages: `realtime.stream( name ).chat( { limit } )`.

## Parameters

| Name | In | |
|---|---|---|
| `name` (required) | path | The stream name, percent-encoded: `show:mugs` is `show%3Amugs`. |
| `limit` | query |  |

## Answer

The messages.

```json
{
  "ok": true,
  "messages": [
    {
      "id": "1791638400000-0",
      "from": {
        "user": "77",
        "name": "Ben",
        "avatar": null,
        "role": "viewer"
      },
      "text": "Do you ship to Canada?",
      "at": 1791638400000
    }
  ]
}
```

## Refusals

- **400**: `bad_request`, `bad_room`: the request is not one the API takes. `reserved`: an event name kept for the room itself.
- **401**: `missing_signature`, `stale_signature` (a clock off by more than 5 minutes), `unknown_site`, `bad_signature` (a wrong secret, or a body or path other than the one signed).
- **403**: `not_included`: your plan does not include it.

## Examples

`wordplus()` (in Go `app.Request()`) signs and sends the request: https://docs.wordplus.cloud/api/signing/ has it in each language.

**curl**

```bash
wordplus GET '/wordplus/realtime/streams/show%3Amugs/chat'
```

**Node**

```js
const { messages } = await wordplus('GET', `/wordplus/realtime/streams/${encodeURIComponent('show:mugs')}/chat`);
```

**Python**

```python
messages = wordplus("GET", f"/wordplus/realtime/streams/{quote('show:mugs', safe='')}/chat")["messages"]
```

**PHP**

```php
$messages = wordplus('GET', '/wordplus/realtime/streams/'.rawurlencode('show:mugs').'/chat')['messages'];
```

**Go**

```go
answer, err := app.Request("GET", "/wordplus/realtime/streams/"+url.PathEscape("show:mugs")+"/chat", nil)
```

