WebSocket RPC

Linea WebSocket RPC

Stream Linea data in real time over a WebSocket connection instead of polling: new blocks and contract events. Every SwiftNodes plan includes a Linea WebSocket endpoint alongside HTTP, with flat-rate pricing and no KYC.

Endpoint

wss://rpc.swiftnodes.io/ws/linea?key=YOUR_API_KEY

The HTTP endpoint for Linea is https://rpc.swiftnodes.io/rpc/linea?key=YOUR_API_KEY. One API key works for both, and across all 75+ supported chains.

Subscribe to Linea in real time

import { createPublicClient, webSocket } from "viem";

const client = createPublicClient({
  transport: webSocket("wss://rpc.swiftnodes.io/ws/linea?key=YOUR_API_KEY"),
});

// Stream new Linea blocks as they're produced (~~6 seconds (varies with load) apart)
const unwatch = client.watchBlocks({
  onBlock: (block) => console.log("new block", block.number),
});

What you can subscribe to

  • New block headers (newHeads): the subscription our health checks open on this chain
  • Contract event logs (logs): filter by address and topics
  • Pending transactions (newPendingTransactions), where the chain exposes a public mempool

Free keys get one WebSocket connection with new-block subscriptions only. Every other subscription listed here needs a paid plan, which also raises the connection limit.

Linea is an zk-Rollup (zkEVM, type-2), with ~~6 seconds (varies with load) block times and soft: one block. hard (l1): ~1-4 hours (zk proof submission) finality. That cadence sets how frequently new-block subscriptions fire.

Frequently asked questions

Does SwiftNodes support Linea WebSocket?

Yes. Every Linea plan includes a WebSocket (wss://) endpoint alongside HTTP, with no separate add-on. Connect to wss://rpc.swiftnodes.io/ws/linea?key=<key> and open subscriptions immediately.

What is the Linea WebSocket URL?

wss://rpc.swiftnodes.io/ws/linea?key=YOUR_API_KEY — replace YOUR_API_KEY with the key from your dashboard. The matching HTTP endpoint is https://rpc.swiftnodes.io/rpc/linea?key=YOUR_API_KEY.

Is there a message rate limit on the WebSocket?

Yes — WebSocket throughput scales with your plan (1 msg/s on Free up to 250 msg/s on Pro), with concurrent-connection limits per plan. The free plan allows one connection with new-block subscriptions only; log and pending-transaction subscriptions need a paid plan. Within those limits, subscriptions stream in real time.

See the full Linea RPC page for chain details, or the WebSocket docs for the complete method list.

Get a Linea endpoint free

HTTP + WebSocket, flat-rate, pay with crypto or card, no KYC. Live in 30 seconds.

Get your API key