WebSocket API Overview
The AnyPay WebSocket API provides real-time access to cryptocurrency data, including transactions, blocks, and price updates. This documentation covers everything you need to integrate our WebSocket API into your application.
Features
- Real-time transaction monitoring
- Live price updates
- Block notifications
- Inscription tracking
- Address balance changes
Configuration
Configure your WebSocket connection with custom endpoints and authentication.
Connection Options
interface WebSocketConfig {url: string;apiKey?: string;}const config: WebSocketConfig = {url: 'wss://ws.anypayx.com',}
Establishing a Connection
Connect to your WebSocket endpoint using the following configuration:
wss://ws.anypayx.com
Connection Example
const config = {url: 'wss://ws.anypayx.com'}const ws = new WebSocket(config.url)ws.onopen = () => {console.log('Connected to WebSocket')}ws.onclose = () => {console.log('Disconnected from WebSocket')}
Transaction Events
Receive real-time notifications for new transactions and mempool updates.
Event Format
{"type": "transaction","data": {"txid": "abc123...","amount": 1.5,"from": "1ABC...","to": "1XYZ...","confirmations": 0,"timestamp": 1234567890}}
Address Monitoring
Subscribe to receive updates for specific addresses.
Subscription Format
{"type": "subscribe","channel": "address","data": {"addresses": ["1ABC...", "1XYZ..."]}}