Skip to content
Developers3 min read

gRPC and WebSocket connection limits and timeouts

gRPC and WebSocket connection limits on OrbitFlare: 50 per IP each, what RESOURCE_EXHAUSTED and code 1008 mean, and how to reconnect.

Julius Schmitt · OrbitFlare
gRPC and WebSocket connection limits and timeouts

Each IP on shared plans is limited to 50 active gRPC connections and 50 active WebSocket connections. Such limitations are in addition to the request-per-second limits on your plan. Idle streams will be terminated, so long-lived clients need to have a ping functionality and reconnect loop. The table below highlights the limits and related errors.

Overview of connection limits

Every limit and the error it throws

The gRPC limitation is global: it counts all Jetstream and Yellowstone connections from your IP to all regions. So, 30 connections in Frankfurt and 20 in New York make 50 connections.

How to solve the RESOURCE_EXHAUSTED problem

Since a single connection can contain an unlimited number of subscriptions, the solution would nearly always be decreasing the number of connections. Use your account filter, transaction filter, and slot filters within a single stream, not in three different streams. Always close inactive streams before creating new streams and ensure a crash loop is not leaving old connections half-open.

In case a job involves more than 50 streams from a single IP simultaneously, use a dedicated gRPC node that is not limited by the shared connection limit. See dedicated nodes.

Maintaining active streams

All gRPC streams without any activity within ~10 minutes are closed by load balancers and proxies. It might affect a quiet filter like a wallet that has no transactions in recent periods of time. Send pings to your stream periodically; in our documentation example such pings are sent every 30 seconds. All of our SDKs send pings automatically.

As for WebSockets, send a ping frame every 20 to 30 seconds. If you don't do that, then your connection will be disconnected after several minutes with close code 1006.

Reconnection process

Connection problems might arise during deployments, because of latency or because of reaching limits. Please consider the following strategy:

  1. Exponential backoff: start with a 1 second delay and double after each error up to 30 seconds.
  2. Continue connecting. Do not give up after a certain number of tries.
  3. Re-subscribe in each new connection because subscriptions do not persist between connections.
  4. Close the previous stream gracefully before opening a new one, so you do not count against your own limit.

Still getting disconnected?

Use the gRPC debugging guide or the WebSocket debugging guide. If you are still choosing a transport, see the Solana WebSockets vs gRPC blog post.

Frequently asked questions

How many gRPC and WebSocket connections can I open per IP on a shared plan?
Shared plans allow 50 concurrent gRPC connections and 50 concurrent WebSocket connections per IP. These limits apply in addition to your plan's requests per second limit.
Does the 50 connection gRPC limit apply per region?
No, the cap is global. It counts every Jetstream and Yellowstone connection from your IP across all regions, so 30 connections in Frankfurt and 20 in New York already add up to 50.
How do I fix RESOURCE_EXHAUSTED: connection limit exceeded?
Open fewer connections. One connection can carry unlimited subscriptions, so combine your account, transaction and slot filters in one stream, shut down unused streams, and make sure a crash loop is not leaving connections half-open.
Why does my idle stream keep closing?
gRPC streams with no traffic for about 10 minutes are closed by load balancers and proxies, which can affect quiet filters. Ping gRPC streams periodically (the documentation example uses 30 seconds), and send a WebSocket ping frame every 20 to 30 seconds to avoid a close with code 1006.
How should a client reconnect after a dropped stream?
Back off exponentially from 1 second, doubling up to a maximum of 30 seconds, and never stop retrying. Close the old stream cleanly first, then re-subscribe on the new connection because subscriptions don't persist across connections.
What if I need more than 50 streams from one IP?
Use a dedicated gRPC node, which has no shared connection cap.

About the author

Julius Schmitt

OrbitFlare

Thanks for reading.Back to all articles

Code. Build. Stream. Without Limits.

Build something that moves.

Choose your infrastructure. We’ll help you find the right setup.

A useful starting point

Edit the brief, then copy it and open your assistant. Paste it into a new chat to get started.

Official sources included. You choose when to send.