Gateway
Bots call this endpoint to get the URL for the Gateway WebSocket. User clients get the same URL from endpoints.gateway in instance discovery.
Gateway information object
Заголовок раздела «Gateway information object»Structure
Заголовок раздела «Structure»| Field | Type | Description |
|---|---|---|
| url | string | The ws or wss Gateway URL |
| shards | integer | The recommended shard count, one for every 2,500 guilds the bot is in, rounded up, and at least 1 |
| session_start_limit | session start limit object | Session start values, the same on every call |
Add the connection parameters to url before you connect. To split a bot across more than one shard, pass shard in Identify.
Example
Заголовок раздела «Example»{ "url": "wss://gateway.example.com", "shards": 1, "session_start_limit": { "total": 1000, "remaining": 999, "reset_after": 14400000, "max_concurrency": 1 }}Session start limit object
Заголовок раздела «Session start limit object»The API returns the same values on every call, and the Gateway doesn’t use them. The limits the Gateway enforces are on Limits and rate limits.
Structure
Заголовок раздела «Structure»| Field | Type | Description |
|---|---|---|
| total | integer | Always 1000 |
| remaining | integer | Always 999 |
| reset_after | integer | Always 14400000 (four hours, in milliseconds) |
| max_concurrency | integer | Always 1 |
Get Gateway information
Заголовок раздела «Get Gateway information»GET
/v1/gateway/botПринимает токен бота.
Returns a Gateway information object. The Authorization header takes Bot <token>, Bearer <token> or the bare token. The token must be a working bot token.
Response
Заголовок раздела «Response»| Status | Body | Condition |
|---|---|---|
| 200 | Gateway information object | The token is a working bot token |
| 401 | error response | MISSING_AUTHORIZATION with no token, INVALID_AUTH_TOKEN when the token is not a working bot token |
The rate limit is 60 requests per minute for each bot, or for each client IP address when the request has no working Bot token, on the gateway:bot_info bucket.