# Websockets — Hanzo AI

> Real-time bidirectional communication with blockchain networks.

Available Now

# Websockets

Live blockchain data streaming

Real-time bidirectional communication with blockchain networks. Subscribe to blocks, transactions, logs, and pending transactions with persistent WebSocket connections.

### Persistent Connections

Long-lived WebSocket connections with automatic reconnection.

### Real-time Streaming

Instant delivery of blocks, transactions, and events.

### Pending Transactions

Subscribe to mempool for pending transaction visibility.

### Low Latency

Sub-100ms latency for time-sensitive applications.

[Back to Web3 Overview](https://hanzo.ai/blockchain)

## Get Your API Key

Start building in under 5 minutes

HA

Failover

<50ms

Latency

100+

Chains

Start Building Free

View Documentation

No credit card required. Free tier includes 300M compute units/month.

Trusted by developers building:

DeFiNFTsPaymentsGamingAI Agents

## Key Capabilities

Everything you need, nothing you don&#x27;t.

### Persistent Connections

Long-lived WebSocket connections with automatic reconnection.

### Real-time Streaming

Instant delivery of blocks, transactions, and events.

### Pending Transactions

Subscribe to mempool for pending transaction visibility.

### Low Latency

Sub-100ms latency for time-sensitive applications.

### Multi-chain Streams

Stream from multiple chains on a single connection.

### Authenticated Sessions

Secure connections with API key authentication.

### Auto-reconnect

Automatic reconnection with message replay on disconnect.

### Filtered Subscriptions

Subscribe to specific addresses, topics, or event types.

### Connection Metrics

Monitor connection health and message throughput.

## Simple to Integrate

Get started with just a few lines of code. SDKs for every language.

Solidity

Node

Python

Go

Rust

C

C++

Ruby

EventEmitter.sol

```
// SPDX-License-Identifier: MIT pragma solidity ^0.8.24; /// @title EventEmitter - Structured events for WebSocket streaming /// @notice Emit indexed events for efficient WebSocket subscriptions contract EventEmitter { // Indexed events for real-time streaming via WebSockets event BlockProcessed( uint256 indexed blockNumber, bytes32 indexed blockHash, uint256 timestamp, uint256 gasUsed ); event TransactionDetected( bytes32 indexed txHash, address indexed from, address indexed to, uint256 value, uint256 gasPrice ); event ContractEvent( address indexed contractAddress, bytes32 indexed eventSignature, bytes data, uint256 indexed logIndex ); // Emit block processing event for indexers function emitBlockProcessed( uint256 _blockNumber, bytes32 _blockHash, uint256 _gasUsed ) external { emit BlockProcessed(_blockNumber, _blockHash, block.timestamp, _gasUsed); } // Emit transaction event for mempool tracking function emitTransaction( bytes32 _txHash, address _from, address _to, uint256 _value, uint256 _gasPrice ) external { emit TransactionDetected(_txHash, _from, _to, _value, _gasPrice); } // Emit contract event for log subscriptions function emitContractEvent( address _contract, bytes32 _eventSig, bytes calldata _data, uint256 _logIndex ) external { emit ContractEvent(_contract, _eventSig, _data, _logIndex); } }
```

## Built For

### Trading Applications

Real-time price feeds and order book updates for DEXs.

### Mempool Monitoring

Track pending transactions for MEV and arbitrage.

### Live Dashboards

Real-time blockchain activity and network stats.

### Bot Infrastructure

High-frequency trading and automated strategies.

## Supported Chains

EthereumPolygonArbitrumOptimismBaseBNB ChainAvalanchezkSyncScrollLinea

## Start Building with Websockets

Get your free API key and ship your first request in under 5 minutes. No credit card required.

Get Your API Key

[Explore All Web3 Products](https://hanzo.ai/blockchain)

## Get Websockets

Deploy in seconds or self-host with the open-source release.

[Deploy to Cloud](https://console.hanzo.ai/deploy)
