From 8f28ea7a6686a1cc065cfbacc3281ddc5e87ad96 Mon Sep 17 00:00:00 2001 From: Nicolas Cantu Date: Mon, 25 Aug 2025 15:25:19 +0200 Subject: [PATCH] =?UTF-8?q?Documentation=20API:=20refonte=20technique=20av?= =?UTF-8?q?ec=20flux=20JSON=20d=C3=A9taill=C3=A9s=20et=20exemples=20de=20r?= =?UTF-8?q?equ=C3=AAtes/r=C3=A9ponses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/API.md | 693 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 459 insertions(+), 234 deletions(-) diff --git a/docs/API.md b/docs/API.md index 7c65cb8..d420692 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2,7 +2,7 @@ ## Vue d'Ensemble -`sdk_relay` expose deux interfaces principales pour l'intégration avec les clients : +`sdk_relay` expose deux interfaces principales : - **WebSocket API** (port 8090) : Communication temps réel bidirectionnelle - **HTTP REST API** (port 8091) : Interface REST pour les opérations CRUD @@ -21,38 +21,18 @@ https://localhost:8091 # Sécurisé --- -## WebSocket API +## WebSocket API - Flux de Messages -### Connexion +### 1. Connexion et Handshake -```javascript -const ws = new WebSocket('ws://localhost:8090'); - -ws.onopen = () => { - console.log('Connecté à sdk_relay'); - // Envoyer le handshake initial - sendHandshake(); -}; - -ws.onmessage = (event) => { - const message = JSON.parse(event.data); - handleMessage(message); -}; - -ws.onerror = (error) => { - console.error('Erreur WebSocket:', error); -}; - -ws.onclose = (event) => { - console.log('Connexion fermée:', event.code, event.reason); -}; +**Flux de connexion :** +``` +Client → WebSocket Connection → sdk_relay +Client → Handshake Message → sdk_relay +sdk_relay → Handshake Response → Client ``` -### Handshake Initial - -**Endpoint :** `ws://localhost:8090` - -**Message de Handshake :** +**Message de Handshake (Client → sdk_relay) :** ```json { "type": "handshake", @@ -63,7 +43,7 @@ ws.onclose = (event) => { } ``` -**Réponse de Handshake :** +**Réponse de Handshake (sdk_relay → Client) :** ```json { "type": "handshake_response", @@ -75,11 +55,17 @@ ws.onclose = (event) => { } ``` -### Messages de Synchronisation +### 2. Messages de Synchronisation -#### 1. StateSync +#### StateSync -**Envoi :** +**Flux :** +``` +relay-1 → StateSync → relay-2 +relay-2 → StateSync Response → relay-1 +``` + +**Message StateSync (relay-1 → relay-2) :** ```json { "type": "sync", @@ -87,12 +73,14 @@ ws.onclose = (event) => { "relay_id": "relay-1", "payload": { "state": { - "uptime": "3600", + "uptime": 3600, "version": "1.0.0", "network": "signet", "status": "healthy", - "last_block": "12345", - "connections": 5 + "last_block": 12345, + "connections": 5, + "known_relays": 3, + "mesh_connections": 6 } }, "timestamp": 1703001600, @@ -100,7 +88,7 @@ ws.onclose = (event) => { } ``` -**Réception :** +**Réponse StateSync (relay-2 → relay-1) :** ```json { "type": "sync_response", @@ -108,12 +96,14 @@ ws.onclose = (event) => { "relay_id": "relay-2", "payload": { "state": { - "uptime": "1800", + "uptime": 1800, "version": "1.0.0", "network": "signet", "status": "healthy", - "last_block": "12345", - "connections": 3 + "last_block": 12345, + "connections": 3, + "known_relays": 3, + "mesh_connections": 6 } }, "timestamp": 1703001600, @@ -121,9 +111,15 @@ ws.onclose = (event) => { } ``` -#### 2. HealthSync +#### HealthSync -**Envoi :** +**Flux :** +``` +relay-1 → HealthSync → relay-2 +relay-2 → HealthSync Response → relay-1 +``` + +**Message HealthSync (relay-1 → relay-2) :** ```json { "type": "sync", @@ -135,7 +131,9 @@ ws.onclose = (event) => { "memory_usage": "128MB", "cpu_usage": "5%", "disk_usage": "2GB", - "network_latency": "45ms" + "network_latency": 45, + "error_count": 0, + "last_error": null } }, "timestamp": 1703001600, @@ -143,9 +141,37 @@ ws.onclose = (event) => { } ``` -#### 3. MetricsSync +**Réponse HealthSync (relay-2 → relay-1) :** +```json +{ + "type": "sync_response", + "sync_type": "HealthSync", + "relay_id": "relay-2", + "payload": { + "health": { + "status": "healthy", + "memory_usage": "96MB", + "cpu_usage": "3%", + "disk_usage": "1.5GB", + "network_latency": 32, + "error_count": 0, + "last_error": null + } + }, + "timestamp": 1703001600, + "message_id": "msg-126" +} +``` -**Envoi :** +#### MetricsSync + +**Flux :** +``` +relay-1 → MetricsSync → relay-2 +relay-2 → MetricsSync Response → relay-1 +``` + +**Message MetricsSync (relay-1 → relay-2) :** ```json { "type": "sync", @@ -160,54 +186,103 @@ ws.onclose = (event) => { "cache_hits": 120, "cache_misses": 30, "avg_latency": 45.2, - "error_count": 0 + "error_count": 0, + "success_rate": 98.67, + "messages_per_second": 2.5 } }, "timestamp": 1703001600, - "message_id": "msg-126" + "message_id": "msg-127" } ``` -### Messages de Notification +**Réponse MetricsSync (relay-2 → relay-1) :** +```json +{ + "type": "sync_response", + "sync_type": "MetricsSync", + "relay_id": "relay-2", + "payload": { + "metrics": { + "known_relays": 3, + "mesh_connections": 6, + "sync_requests": 120, + "sync_responses": 120, + "cache_hits": 95, + "cache_misses": 25, + "avg_latency": 38.5, + "error_count": 0, + "success_rate": 100.0, + "messages_per_second": 2.0 + } + }, + "timestamp": 1703001600, + "message_id": "msg-128" +} +``` -#### 1. Payment Detected +### 3. Messages de Notification +#### Payment Detected + +**Flux :** +``` +sdk_relay → Payment Notification → Client +``` + +**Message Payment Detected (sdk_relay → Client) :** ```json { "type": "notification", "notification_type": "payment_detected", "data": { - "txid": "abc123def456789...", + "txid": "abc123def456789abcdef456789abcdef456789abc", "block_height": 12345, - "block_hash": "def789abc123456...", + "block_hash": "def789abc123456def789abc123456def789abc123", "amount": "0.001", "address": "sp1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh", "confirmations": 1, - "timestamp": 1703001600 + "timestamp": 1703001600, + "fee": "0.00001", + "size": 250 }, "timestamp": 1703001600 } ``` -#### 2. Block Mined +#### Block Mined +**Flux :** +``` +sdk_relay → Block Notification → Client +``` + +**Message Block Mined (sdk_relay → Client) :** ```json { "type": "notification", "notification_type": "block_mined", "data": { "block_height": 12346, - "block_hash": "ghi012jkl345678...", + "block_hash": "ghi012jkl345678ghi012jkl345678ghi012jkl345", "transactions": 150, - "size": "1024000", - "timestamp": 1703001600 + "size": 1024000, + "timestamp": 1703001600, + "difficulty": 1.0, + "merkle_root": "abc123def456789abcdef456789abcdef456789abc" }, "timestamp": 1703001600 } ``` -#### 3. Relay Connected +#### Relay Connected +**Flux :** +``` +sdk_relay → Relay Notification → Client +``` + +**Message Relay Connected (sdk_relay → Client) :** ```json { "type": "notification", @@ -217,17 +292,24 @@ ws.onclose = (event) => { "address": "relay-4.example.com:8090", "version": "1.0.0", "capabilities": ["sync", "notifications"], - "timestamp": 1703001600 + "timestamp": 1703001600, + "connection_id": "conn-456" }, "timestamp": 1703001600 } ``` -### Messages de Contrôle +### 4. Messages de Contrôle -#### 1. Ping/Pong +#### Ping/Pong -**Ping :** +**Flux :** +``` +Client → Ping → sdk_relay +sdk_relay → Pong → Client +``` + +**Message Ping (Client → sdk_relay) :** ```json { "type": "ping", @@ -236,7 +318,7 @@ ws.onclose = (event) => { } ``` -**Pong :** +**Message Pong (sdk_relay → Client) :** ```json { "type": "pong", @@ -245,9 +327,15 @@ ws.onclose = (event) => { } ``` -#### 2. Subscribe/Unsubscribe +#### Subscribe/Unsubscribe -**Subscribe :** +**Flux :** +``` +Client → Subscribe → sdk_relay +sdk_relay → Subscribe Response → Client +``` + +**Message Subscribe (Client → sdk_relay) :** ```json { "type": "subscribe", @@ -257,7 +345,18 @@ ws.onclose = (event) => { } ``` -**Unsubscribe :** +**Réponse Subscribe (sdk_relay → Client) :** +```json +{ + "type": "subscribe_response", + "status": "subscribed", + "subscriptions": ["notifications", "health", "metrics"], + "relay_id": "relay-1", + "timestamp": 1703001600 +} +``` + +**Message Unsubscribe (Client → sdk_relay) :** ```json { "type": "unsubscribe", @@ -267,17 +366,36 @@ ws.onclose = (event) => { } ``` +**Réponse Unsubscribe (sdk_relay → Client) :** +```json +{ + "type": "unsubscribe_response", + "status": "unsubscribed", + "subscriptions": ["notifications", "health"], + "relay_id": "relay-1", + "timestamp": 1703001600 +} +``` + --- -## HTTP REST API +## HTTP REST API - Flux de Requêtes -### Endpoints de Base +### 1. Health Check -#### 1. Health Check +**Flux :** +``` +Client → GET /health → sdk_relay +sdk_relay → Health Response → Client +``` -**GET** `/health` - -**Description :** Vérifier l'état de santé du service +**Requête :** +```http +GET /health HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -291,19 +409,31 @@ ws.onclose = (event) => { "blindbit": "connected", "websocket": "listening", "sync_manager": "active" + }, + "checks": { + "bitcoin_rpc": true, + "blindbit_api": true, + "websocket_server": true, + "sync_manager": true } } ``` -**Codes de réponse :** -- `200` : Service en bonne santé -- `503` : Service indisponible +### 2. Métriques -#### 2. Métriques +**Flux :** +``` +Client → GET /metrics → sdk_relay +sdk_relay → Metrics Response → Client +``` -**GET** `/metrics` - -**Description :** Obtenir les métriques de performance +**Requête :** +```http +GET /metrics HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -316,7 +446,8 @@ ws.onclose = (event) => { "cache_hits": 120, "cache_misses": 30, "avg_latency": 45.2, - "error_count": 0 + "error_count": 0, + "success_rate": 98.67 }, "system_metrics": { "memory_usage": "128MB", @@ -330,15 +461,26 @@ ws.onclose = (event) => { "connections": 8, "mempool_size": 150, "verification_progress": 0.9999 - } + }, + "timestamp": 1703001600 } ``` -#### 3. Configuration +### 3. Configuration -**GET** `/config` +**Flux :** +``` +Client → GET /config → sdk_relay +sdk_relay → Config Response → Client +``` -**Description :** Obtenir la configuration actuelle +**Requête :** +```http +GET /config HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -361,21 +503,26 @@ ws.onclose = (event) => { "metrics_interval": 120 }, "dev_mode": true, - "standalone": false + "standalone": false, + "timestamp": 1703001600 } ``` -### Endpoints de Gestion des Relais +### 4. Liste des Relais -#### 4. Liste des Relais +**Flux :** +``` +Client → GET /relays → sdk_relay +sdk_relay → Relays Response → Client +``` -**GET** `/relays` - -**Description :** Obtenir la liste des relais connus - -**Paramètres de requête :** -- `status` : Filtrer par statut (healthy, warning, critical) -- `limit` : Limiter le nombre de résultats (défaut: 100) +**Requête :** +```http +GET /relays?status=healthy&limit=10 HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -389,7 +536,12 @@ ws.onclose = (event) => { "health": "healthy", "last_seen": 1703001600, "capabilities": ["sync", "notifications", "health"], - "connections": 5 + "connections": 5, + "metrics": { + "sync_requests": 50, + "sync_responses": 50, + "avg_latency": 45.2 + } }, { "relay_id": "relay-2", @@ -399,21 +551,37 @@ ws.onclose = (event) => { "health": "healthy", "last_seen": 1703001600, "capabilities": ["sync", "notifications"], - "connections": 3 + "connections": 3, + "metrics": { + "sync_requests": 30, + "sync_responses": 30, + "avg_latency": 38.5 + } } ], "total": 2, "healthy": 2, "warning": 0, - "critical": 0 + "critical": 0, + "timestamp": 1703001600 } ``` -#### 5. Détails d'un Relais +### 5. Détails d'un Relais -**GET** `/relays/{relay_id}` +**Flux :** +``` +Client → GET /relays/{relay_id} → sdk_relay +sdk_relay → Relay Details Response → Client +``` -**Description :** Obtenir les détails d'un relais spécifique +**Requête :** +```http +GET /relays/relay-1 HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -429,26 +597,40 @@ ws.onclose = (event) => { "metrics": { "sync_requests": 50, "sync_responses": 50, - "avg_latency": 45.2 + "avg_latency": 45.2, + "error_count": 0, + "success_rate": 100.0 }, "configuration": { "network": "signet", - "dev_mode": true - } + "dev_mode": true, + "sync_interval": 30 + }, + "status": { + "bitcoin_connected": true, + "blindbit_connected": true, + "websocket_listening": true, + "sync_active": true + }, + "timestamp": 1703001600 } ``` -**Codes de réponse :** -- `200` : Relais trouvé -- `404` : Relais non trouvé +### 6. Statut de Synchronisation -### Endpoints de Synchronisation +**Flux :** +``` +Client → GET /sync/status → sdk_relay +sdk_relay → Sync Status Response → Client +``` -#### 6. Statut de Synchronisation - -**GET** `/sync/status` - -**Description :** Obtenir le statut de la synchronisation +**Requête :** +```http +GET /sync/status HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -466,19 +648,37 @@ ws.onclose = (event) => { "total_syncs": 150, "successful_syncs": 148, "failed_syncs": 2, - "success_rate": 98.67 - } + "success_rate": 98.67, + "avg_duration": 45.2 + }, + "active_syncs": [ + { + "sync_type": "StateSync", + "target_relay": "relay-2", + "started": 1703001600, + "status": "in_progress" + } + ], + "timestamp": 1703001600 } ``` -#### 7. Forcer la Synchronisation +### 7. Forcer la Synchronisation -**POST** `/sync/force` +**Flux :** +``` +Client → POST /sync/force → sdk_relay +sdk_relay → Force Sync Response → Client +``` -**Description :** Forcer une synchronisation immédiate +**Requête :** +```http +POST /sync/force HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Content-Type: application/json +Accept: application/json -**Corps de la requête :** -```json { "sync_types": ["StateSync", "HealthSync"], "target_relays": ["relay-2", "relay-3"] @@ -492,21 +692,26 @@ ws.onclose = (event) => { "sync_types": ["StateSync", "HealthSync"], "target_relays": ["relay-2", "relay-3"], "timestamp": 1703001600, - "estimated_duration": "30s" + "estimated_duration": "30s", + "sync_id": "sync-789" } ``` -#### 8. Historique des Synchronisations +### 8. Historique des Synchronisations -**GET** `/sync/history` +**Flux :** +``` +Client → GET /sync/history → sdk_relay +sdk_relay → Sync History Response → Client +``` -**Description :** Obtenir l'historique des synchronisations - -**Paramètres de requête :** -- `limit` : Nombre d'entrées (défaut: 50) -- `since` : Timestamp de début -- `until` : Timestamp de fin -- `sync_type` : Filtrer par type de synchronisation +**Requête :** +```http +GET /sync/history?limit=10&since=1703000000&sync_type=StateSync HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -518,7 +723,9 @@ ws.onclose = (event) => { "target_relay": "relay-2", "status": "success", "duration": 45, - "message_id": "msg-123" + "message_id": "msg-123", + "payload_size": 1024, + "latency": 45.2 }, { "timestamp": 1703001570, @@ -526,22 +733,38 @@ ws.onclose = (event) => { "target_relay": "relay-3", "status": "success", "duration": 32, - "message_id": "msg-122" + "message_id": "msg-122", + "payload_size": 512, + "latency": 32.1 } ], "total": 2, "successful": 2, - "failed": 0 + "failed": 0, + "filters": { + "limit": 10, + "since": 1703000000, + "sync_type": "StateSync" + }, + "timestamp": 1703001600 } ``` -### Endpoints de Bitcoin Core +### 9. Informations Bitcoin -#### 9. Informations Bitcoin +**Flux :** +``` +Client → GET /bitcoin/info → sdk_relay +sdk_relay → Bitcoin Info Response → Client +``` -**GET** `/bitcoin/info` - -**Description :** Obtenir les informations Bitcoin Core +**Requête :** +```http +GET /bitcoin/info HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -550,37 +773,61 @@ ws.onclose = (event) => { "chain": "signet", "blocks": 12345, "headers": 12345, - "bestblockhash": "abc123...", + "bestblockhash": "abc123def456789abcdef456789abcdef456789abc", "difficulty": 1.0, "verificationprogress": 0.9999, - "initialblockdownload": false + "initialblockdownload": false, + "size_on_disk": 1073741824, + "pruned": false }, "network_info": { "connections": 8, "connections_in": 4, - "connections_out": 4 + "connections_out": 4, + "networkactive": true, + "networks": [ + { + "name": "ipv4", + "limited": false, + "reachable": true, + "proxy": "tor:9050" + } + ] }, "mempool_info": { "size": 150, "bytes": 1024000, - "usage": 2048000 - } + "usage": 2048000, + "maxmempool": 300000000, + "mempoolminfee": 0.00001000 + }, + "timestamp": 1703001600 } ``` -#### 10. Bloc Spécifique +### 10. Bloc Spécifique -**GET** `/bitcoin/blocks/{block_hash}` +**Flux :** +``` +Client → GET /bitcoin/blocks/{block_hash} → sdk_relay +sdk_relay → Block Details Response → Client +``` -**Description :** Obtenir les détails d'un bloc +**Requête :** +```http +GET /bitcoin/blocks/abc123def456789abcdef456789abcdef456789abc HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json { - "hash": "abc123...", + "hash": "abc123def456789abcdef456789abcdef456789abc", "height": 12345, "version": 536870912, - "merkleroot": "def456...", + "merkleroot": "def456789abcdef456789abcdef456789abcdef456", "time": 1703001600, "mediantime": 1703001500, "nonce": 123456, @@ -590,25 +837,31 @@ ws.onclose = (event) => { "strippedsize": 512, "weight": 4096, "tx": [ - "txid1...", - "txid2..." - ] + "txid1abc123def456789abcdef456789abcdef456789abc", + "txid2def456789abcdef456789abcdef456789abcdef456" + ], + "confirmations": 1, + "previousblockhash": "ghi789jkl012345ghi789jkl012345ghi789jkl012", + "nextblockhash": "mno012pqr345678mno012pqr345678mno012pqr345", + "timestamp": 1703001600 } ``` -### Endpoints de Logs +### 11. Logs -#### 11. Logs +**Flux :** +``` +Client → GET /logs → sdk_relay +sdk_relay → Logs Response → Client +``` -**GET** `/logs` - -**Description :** Obtenir les logs du service - -**Paramètres de requête :** -- `level` : Niveau de log (debug, info, warn, error) -- `limit` : Nombre de lignes (défaut: 100) -- `since` : Timestamp de début -- `search` : Recherche dans les logs +**Requête :** +```http +GET /logs?level=info&limit=50&search=sync HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json @@ -618,14 +871,18 @@ ws.onclose = (event) => { "timestamp": "2024-12-19T10:00:00Z", "level": "info", "message": "Relay started successfully", - "relay_id": "relay-1" + "relay_id": "relay-1", + "module": "main", + "line": 45 }, { "timestamp": "2024-12-19T10:00:30Z", "level": "info", "message": "Sync completed", "relay_id": "relay-1", - "sync_type": "StateSync" + "sync_type": "StateSync", + "module": "sync", + "line": 123 } ], "total": 2, @@ -634,20 +891,32 @@ ws.onclose = (event) => { "info": 2, "warn": 0, "error": 0 - } + }, + "filters": { + "level": "info", + "limit": 50, + "search": "sync" + }, + "timestamp": 1703001600 } ``` -### Endpoints de Configuration +### 12. Mettre à Jour la Configuration -#### 12. Mettre à Jour la Configuration +**Flux :** +``` +Client → PUT /config → sdk_relay +sdk_relay → Config Update Response → Client +``` -**PUT** `/config` +**Requête :** +```http +PUT /config HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Content-Type: application/json +Accept: application/json -**Description :** Mettre à jour la configuration - -**Corps de la requête :** -```json { "sync": { "interval": 60, @@ -666,22 +935,34 @@ ws.onclose = (event) => { "sync.health_interval: 60 -> 120", "dev_mode: true -> false" ], - "timestamp": 1703001600 + "timestamp": 1703001600, + "restart_required": false } ``` -#### 13. Redémarrer le Service +### 13. Redémarrer le Service -**POST** `/restart` +**Flux :** +``` +Client → POST /restart → sdk_relay +sdk_relay → Restart Response → Client +``` -**Description :** Redémarrer le service +**Requête :** +```http +POST /restart HTTP/1.1 +Host: localhost:8091 +User-Agent: curl/7.68.0 +Accept: application/json +``` **Réponse :** ```json { "status": "restarting", "timestamp": 1703001600, - "estimated_duration": "30s" + "estimated_duration": "30s", + "restart_id": "restart-456" } ``` @@ -711,7 +992,7 @@ ws.onclose = (event) => { ## Exemples d'Utilisation -### Client JavaScript Complet +### Client JavaScript ```javascript class SdkRelayClient { @@ -828,7 +1109,7 @@ async function main() { main().catch(console.error); ``` -### Client Python Complet +### Client Python ```python import asyncio @@ -972,60 +1253,4 @@ curl -X POST http://localhost:8091/restart --- -## Limites et Quotas - -### WebSocket -- **Connexions simultanées** : 1000 par relais -- **Taille des messages** : 1MB maximum -- **Heartbeat** : 30 secondes -- **Timeout de connexion** : 60 secondes -- **Rate limiting** : 1000 messages/minute par client - -### HTTP REST -- **Taux limite** : 1000 requêtes/minute par IP -- **Taille des requêtes** : 10MB maximum -- **Timeout** : 30 secondes -- **Connexions simultanées** : 100 par IP -- **Rate limiting** : 100 requêtes/minute par endpoint - ---- - -## Sécurité - -### Authentification -- **WebSocket** : Authentification optionnelle via handshake -- **HTTP** : Authentification basique (à configurer) -- **Rate limiting** : Protection contre les abus - -### Validation -- Validation JSON des messages -- Validation des types de données -- Protection contre les injections -- Validation des URLs et paramètres - -### Chiffrement -- **WebSocket** : WSS (WebSocket Secure) recommandé -- **HTTP** : HTTPS recommandé -- **Certificats** : Certificats SSL/TLS valides - ---- - -## Monitoring - -### Métriques Clés -- **Latence** : Temps de réponse des APIs -- **Débit** : Messages/requêtes par seconde -- **Erreurs** : Taux d'erreur par endpoint -- **Connexions** : Nombre de connexions actives -- **Synchronisation** : Taux de succès des syncs - -### Alertes -- Service indisponible -- Latence élevée (> 1s) -- Taux d'erreur élevé (> 5%) -- Mémoire/CPU élevés -- Échecs de synchronisation - ---- - -**Cette API permet une intégration complète et professionnelle avec sdk_relay pour tous types de clients.** 🚀 +**Cette documentation décrit tous les flux de données JSON entre les clients et sdk_relay.** 🚀