API Overview
GRIPLOCK exposes several APIs for communication between components. This reference covers the signaling server WebSocket API and message payload formats.API Types
| API | Protocol | Purpose |
|---|---|---|
| Signaling API | WebSocket | Connection establishment and message relay |
| Data Channel API | WebRTC | Peer-to-peer encrypted data transfer |
| Blockchain API | JSON-RPC | Solana mainnet queries |
Architecture
Signaling Server
The signaling server facilitates WebRTC connection establishment:Endpoint
Connection Flow
- Dashboard connects and registers with session ID
- Mobile scans QR and connects with same session ID
- Server relays WebRTC signaling messages
- P2P connection established, server role ends
Message Types
| Type | Direction | Purpose |
|---|---|---|
register_dashboard | Dashboard → Server | Join session as dashboard |
register_mobile | Mobile → Server | Join session as mobile |
mobile_connected | Server → Dashboard | Notify of mobile presence |
answer | Mobile → Server → Dashboard | WebRTC answer SDP |
ice_candidate | Bidirectional | ICE candidate exchange |
encrypted_credentials | Mobile → Dashboard | Encrypted wallet data |
WebRTC Data Channel
After signaling completes, a direct P2P channel carries encrypted data:Channel Properties
| Property | Value |
|---|---|
| Label | griplock-data |
| Ordered | true |
| Max Retransmits | Unlimited |
Message Format
All data channel messages are JSON-encoded:Solana RPC
The dashboard queries Solana mainnet directly:Endpoint
Methods Used
| Method | Purpose |
|---|---|
getBalance | SOL balance for address |
getTokenAccountsByOwner | SPL token holdings |
getSignaturesForAddress | Transaction history |
Rate Limits
Public Solana RPC has rate limits. For production deployments, consider:- Private RPC endpoints (QuickNode, Alchemy, Helius)
- Caching layer for balance/token queries
- Request batching where possible
Authentication
Session-Based
Each connection is associated with a session ID:No API Keys
The signaling server doesn’t require API keys. Security relies on:- Ephemeral session IDs
- End-to-end encryption
- WebRTC peer verification
Error Handling
WebSocket Errors
| Code | Meaning | Action |
|---|---|---|
| 1000 | Normal close | Reconnect if needed |
| 1001 | Going away | Server shutdown, retry later |
| 1006 | Abnormal close | Network issue, retry with backoff |
RPC Errors
| Code | Meaning |
|---|---|
| -32600 | Invalid request |
| -32601 | Method not found |
| -32602 | Invalid params |
| -32700 | Parse error |
| 429 | Rate limited |
