# WebSocket Connection

## Overview

The RMS-Socket service provides real-time event streaming via secure WebSocket connections. Clients receive instant updates for betting approval operations without needing to poll the API.

Bet approval operations occur on bet slips that reach the **Bet Referral** page and are manually approved or rejected by your team.

**Key Features:**

* Secure WebSocket (WSS) connections
* Real-time message broadcasting
* Customer-platform isolated rooms
* Support for multiple event types

**Supported Events:**

| Event                | Description                           |
| -------------------- | ------------------------------------- |
| `RESERVE_BET_ACCEPT` | Reserved bet acceptance notifications |
| `RESERVE_BET_REJECT` | Reserved bet rejection notifications  |

***

## Connection Requirements

### Endpoint

| Environment | URL                    |
| ----------- | ---------------------- |
| Production  | `wss://rms.lsports.eu` |

**Path:** `/rms-socket/socket.io`

### Required Headers

| Header          | Type   | Required | Description                                                       |
| --------------- | ------ | -------- | ----------------------------------------------------------------- |
| `Authorization` | String | Yes      | Bearer token from ARENA360 authentication: `Bearer <accessToken>` |
| `customerid`    | String | Yes      | Your numeric Customer ID                                          |

> Refer to the [Authentication Guide](/u/defend/integration-guide/authentication.md) for obtaining access tokens.

***

## Authentication

Before establishing a WebSocket connection, you must obtain a valid access token using your ARENA360 API credentials.

Refer to the [Authentication Guide](/u/defend/integration-guide/authentication.md) for steps on:

1. Generating API tokens in ARENA360
2. Exchanging credentials for access tokens
3. Refreshing expired tokens

**Important Notes:**

* Access tokens expire every **30 minutes**
* Refresh tokens are valid for **7 days**
* Include the access token in the `Authorization` header as: `Bearer <accessToken>`

***

## Rate Limiting

| Limit Type            | Threshold      | Window                |
| --------------------- | -------------- | --------------------- |
| WebSocket Connections | 10 connections | Per minute per IP     |
| HTTP Requests         | 100 requests   | Per 15 minutes per IP |

Exceeding these limits will result in a `429 Too Many Requests` error.

***

## Next Steps

* [Quick Start & Best Practices](/u/defend/websocket-connection/quick-start-and-best-practices.md) — Get connected in minutes
* [Code Examples](/u/defend/websocket-connection/code-examples.md) — Complete examples in JavaScript, Python, and Browser
* [Error Handling](/u/defend/websocket-connection/error-handling.md) — Error codes and troubleshooting guide


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lsports.eu/u/defend/websocket-connection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
