Skip to main content
Track your Gelato transactions in real-time using WebSocket connections instead of polling. WebSockets provide instant status updates as your transactions move through the lifecycle.

Using the SDK

WebSockets are enabled by default in the @gelatocloud/gasless SDK. Methods automatically race WebSocket notifications against HTTP polling for the fastest result. To disable WebSockets:

Subscribe to a Single Transaction

Subscribe to All Transactions

Unsubscribe

WebSocket API

Real-time updates for transactions via WebSocket connections.

Authentication

All WebSocket endpoints require API key authentication. Pass key in Authorization header:
If you are on a browser you can also pass the API key as a query parameter in the URL: wss://api.gelato.cloud/ws?apiKey=YOUR_API_KEY

Simple Transaction Subscription

Auto-subscribes to a specific transaction. Uses JSON-RPC 2.0 format for all messages. URL: wss://api.gelato.cloud/ws/transactions/:id

Advanced Subscription (JSON-RPC)

Flexible filtering: multiple transactions, chains, event types. Subscribe/unsubscribe dynamically. URL: wss://api.gelato.cloud/ws Protocol: JSON-RPC 2.0 Method: subscribe Params:
  • transactionId (string, optional): Specific transaction ID (max 200 chars)
  • chainIds (string[], optional): Chain IDs to filter (max 50)
  • eventTypes (string[], optional): Event type patterns (max 20)
At least one filter required. Event type patterns: See Events & Status Codes for the full list. Use transaction.* for all events or * for everything.

Unsubscribe

Works on both /ws/transactions/:id and /ws connections. Method: unsubscribe Params: [subscriptionId]

Message Types

Connection Confirmation (JSON-RPC) Sent when connection established on /ws:
Connection Confirmation (Simple Endpoints) Sent when connection established on /ws/transactions/:id:
Error Response
Ping/Pong Keep connection alive by sending ping:

Connection Health

Server Heartbeat The server sends native WebSocket ping frames every 30 seconds. Clients should respond with pong frames (most WebSocket libraries handle this automatically). If the server doesn’t receive a pong within 60 seconds, it will close the connection with code 1000.
This is separate from the JSON {type: "ping"} message, which is also supported for backward compatibility.
WebSocket Close Codes When the server closes a connection, it sends a close frame with a status code and optional reason:

Events & Status Codes

Use transaction.* to subscribe to all transaction events, or * for all events. Base Fields (All Statuses) All status objects include:
  • id (string): Transaction identifier
  • status (number): Status code (100/110/200/400/500)
  • chainId (string): Chain ID
  • createdAt (number): Unix timestamp (seconds)
Status-Specific Fields
Receipt structure varies by chain type. All receipts include the transaction hash and chain-specific execution details.
For complete RPC method documentation, see relayer_getStatus.

Error Codes

Standard JSON-RPC error codes: