# 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](https://docs.lsports.eu/u/defend/integration-guide/authentication) 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](https://docs.lsports.eu/u/defend/integration-guide/authentication) 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](https://docs.lsports.eu/u/defend/websocket-connection/quick-start-and-best-practices) — Get connected in minutes
* [Code Examples](https://docs.lsports.eu/u/defend/websocket-connection/code-examples) — Complete examples in JavaScript, Python, and Browser
* [Error Handling](https://docs.lsports.eu/u/defend/websocket-connection/error-handling) — Error codes and troubleshooting guide
