Skip to main content
Lasso’s WebSocket endpoints use raw JSON-RPC protocol for real-time blockchain data streaming. Connect via standard WebSocket clients for subscriptions and unary RPC requests.

Connection URLs

All WebSocket endpoints follow the pattern ws://host/ws/rpc/... (or wss:// for secure connections).

Base Endpoint

Routes using the default strategy (configurable, defaults to load_balanced). Example:

Strategy-Specific Endpoints

Route connections using a specific routing strategy. Example:

Provider Override

Connect directly to a specific provider, bypassing strategy selection. Example:

Profile-Scoped Endpoints

All routes above are available under a profile namespace:
Without an explicit profile, requests use the "default" profile. Example:

Chain Identifier

The :chain parameter accepts either:
  • Chain name (string): ethereum, base, arbitrum
  • Chain ID (numeric): 1, 8453, 42161

Authentication

All WebSocket endpoints require an API key. Provide it via: | Method | Example | |--------|---------|| | Query parameter | ?key=lasso_abc123 | | Header (at connection) | X-Lasso-Api-Key: lasso_abc123 | | Bearer token | Authorization: Bearer lasso_abc123 | Connection Example:

Protocol

Lasso uses raw JSON-RPC 2.0 over WebSocket (not Phoenix Channels).

Unary Request/Response

Client sends:
Server responds:

Subscription Flow

See Subscriptions for detailed subscription patterns.

Supported Methods

Read-Only Methods

All standard Ethereum read-only methods are supported:
  • eth_blockNumber
  • eth_getBlockByNumber
  • eth_getBlockByHash
  • eth_getLogs
  • eth_getBalance
  • eth_getTransactionCount
  • eth_getCode
  • eth_call
  • eth_estimateGas
  • eth_gasPrice
  • eth_maxPriorityFeePerGas
  • eth_feeHistory
  • eth_chainId (served locally, no upstream call)
  • eth_getTransactionByHash
  • eth_getTransactionReceipt
  • eth_getStorageAt

Subscription Methods

  • eth_subscribe - Create subscription (newHeads, logs)
  • eth_unsubscribe - Cancel subscription
See Subscriptions for details.

Error Responses

Errors follow JSON-RPC 2.0 format:

Common Error Codes

| Code | Meaning | |------|---------|| | -32700 | Parse error (malformed JSON) | | -32600 | Invalid Request (missing required fields) | | -32601 | Method not found or not supported | | -32602 | Invalid params (unsupported chain, missing parameters) | | -32603 | Internal error | | -32000 | Server error (rate limit, strategy access denied, quota exceeded) |

Observability Metadata

Request routing metadata by adding "lasso_meta": "notify" to your request:
The server sends two frames:
  1. The RPC response (unmodified)
  2. A metadata notification:

Connection Lifecycle

See Connection Lifecycle for details on heartbeats, timeouts, and session management.