0%
SupportSubscription API
Do WebSockets Need a Ping to Stay Alive with Alchemy?

Do WebSockets Need a Ping to Stay Alive with Alchemy?

Written by Author headshotKilliane Menand
Published on October 8, 20241 min read

When using Alchemy’s WebSockets, it’s important to understand how “pings” work for maintaining your connection and ensuring communication with the Alchemy servers.

Our Alchemy SDK automatically sends a net_version heartbeat ping to the Alchemy servers every 30 seconds. This is done to maintain the connection and verify the server’s liveness. The great news is that these pings incur zero Compute Units (CUs) comsumption.

📘 For more details on the net_version method, you can refer to our documentation here.

You don’t need to manually send pings to keep your WebSocket connection alive. Alchemy servers will periodically send pings to your client to check for liveness, and as long as your client responds to these pings, the connection will remain active.

To maintain your WebSocket connection with Alchemy, rely on the SDK’s automatic net_version pings or the pings sent by the server. There’s no need to implement custom pings on your end. Just ensure your client responds to the server’s pings to keep the connection alive!

Was this article helpful?
Share:
Banner background image

Not finding what you need?