For the complete documentation index, see llms.txt. This page is also available as Markdown.

WebSocket Transaction Submission

Astralane's WebSocket endpoint provides a fast, browser-native path for submitting Solana transactions. Designed for frontends and trading terminals where QUIC (mTLS) isn't available.

Available Endpoints

Location
Endpoint

Frankfurt (Recommended)

wss://fr.gateway.astralane.io:5500

Frankfurt

wss://fr2.gateway.astralane.io:5500

San Francisco

wss://la.gateway.astralane.io:5500

Tokyo

wss://jp.gateway.astralane.io:5500

New York

wss://ny.gateway.astralane.io:5500

Amsterdam (Recommended)

wss://ams.gateway.astralane.io:5500

Amsterdam 2

wss://ams2.gateway.astralane.io:5500

Limburg

wss://lim.gateway.astralane.io:5500

Singapore

wss://sg.gateway.astralane.io:5500

Lithuania

wss://lit.gateway.astralane.io:5500

London

wss://lon.gateway.astralane.io:5500

Available Paths

Path
Description

/iris

Standard transaction submission

/mev-protect

MEV-protected transaction submission

Example URLs:

wss://fr.gateway.astralane.io:5500/iris?api_key=your-api-key
wss://fr.gateway.astralane.io:5500/mev-protect?api_key=your-api-key

HTTP/JSON-RPC vs WebSocket

Parameter
HTTP/JSON-RPC
WebSocket

Latency

HTTP overhead + JSON serialization per request

Single handshake, then raw binary frames

Connection

New round trip per transaction

Persistent - one connection, unlimited transactions

Serialization

JSON-RPC wrapping + base64 encoding

Raw binary transaction bytes, no encoding

CORS

Requires CORS headers, preflight requests

No CORS restrictions - works from any domain

Response model

Synchronous - client waits for JSON-RPC response

Fire-and-forget - no response, no blocking

Browser support

fetch() API

Native new WebSocket()

Dead connection

Not detected - ephemeral connections

Auto-detected via ping/pong heartbeat

Protocol overhead

HTTP headers (~500 bytes) per request

~6 bytes WebSocket framing per message

Why Use WebSocket?

  • Browser-native: Works directly from any browser with new WebSocket() - no libraries, no backend proxy needed

  • Zero CORS issues: WebSocket connections bypass CORS entirely, unlike HTTP endpoints

  • Persistent connection: One handshake, then send unlimited transactions with minimal framing overhead

  • Raw binary: Send serialized Solana transaction bytes directly - no base64 encoding, no JSON-RPC wrapping

  • Fire-and-forget: Send and move on, no response parsing needed

  • Dead connection detection: Server sends ping every 25s, automatically cleans up dead connections

Important: Fire-and-Forget

Unlike JSON-RPC endpoints (e.g., /iris) which return a transaction signature in the response, the WebSocket endpoint does not return any response. Transactions are forwarded silently with no signature, no acknowledgment, no error message is sent back to the client.

This means:

  • You must track signatures client-side: since you sign the transaction before sending, you already have the signature.

  • Rate-limited transactions are silently dropped: the connection stays alive, but excess transactions are not forwarded. Monitor your transaction landing rate to detect if you're being rate limited.

  • Invalid transactions are silently dropped: transactions exceeding the size limit or failing validation are discarded without notification.

Getting Started


Keep-Alive / Ping-Pong

The server sends a WebSocket Ping frame every 25 seconds. Your client must respond with a Pong frame within 30 seconds, or the connection will be closed.

  • Browser (JavaScript): Handled automatically, no code needed.

  • Python (websockets): Handled automatically, the library responds to pings by default.

  • Rust (tokio-tungstenite): Pong responses are queued automatically but only flushed when you read from the stream. If your code only sends (fire-and-forget), you must spawn a separate task to read from the stream so pongs get flushed. Refer to the Rust example.

If you're using a library that does not auto-respond to pings, you must manually send a Pong frame when you receive a Ping. Consult your library's documentation.


Server Limits

Parameter
Value
Description

Max transaction size

1232 bytes

Standard Solana transaction size limit

Pong timeout

30 s

Server sends a ping every 25s; connection closed if no pong received within 30s

Idle timeout

300 s

Connection closed if no transaction sent within 5 minutes

Handshake timeout

5 s

WebSocket upgrade must complete within this window

Max connections per API key

5000

Total concurrent connections allowed per API key

Max connections per IP

2

Total concurrent connections allowed per client IP


Error Handling

The server may close your connection for these reasons:

Reason
When It Happens

Missing API key

No api_key query parameter in the URL

Unknown API key

API key not recognized or inactive

Connection limit

Too many connections for this API key or IP

Pong timeout

Client stopped responding to ping frames (dead connection)

Idle timeout

No transaction sent within the idle timeout window

Unknown path

Requested path is not /iris or /mev-protect (rejected during handshake with 404)

Last updated