keepAlive feature lets you keep sessions alive across disconnects, so you can reconnect and continue using the same session.
| When connection closes | |
|---|---|
| Without keep alive | Session ends |
| With keep alive | Session stays available for reconnection |
Session keep alive is only available on paid plans.
Why use keep alive?
- Reconnection workflows: Connect, disconnect, and reconnect to the same session
- Multiple connections: Different scripts or tools can connect to the same session
- Survive disconnects: Network issues won’t end your session
- Performance: Reconnecting to an existing session is faster than creating a new one
- Session reuse: Re-run scripts against the same session without recreating it
- Billing optimization: keep alive lets you avoid minimum browser usage charges if running many short-lived sessions (under 1 minute)
Using keep alive
Creating a keep alive session
SettingkeepAlive to true keeps the session available for later use. Reconnect to the keep alive session using the same connect URL.
- Node.js
- Python
Releasing a keep alive session
Keep alive sessions must be explicitly released to stop; otherwise, they’ll continue until the session’s timeout.Release keep alive sessions when you’re done to avoid being charged for unused browser minutes.
- Node.js
- Python
Keep alive and timeouts
Keep alive sessions still respect session timeouts. If you need a session that both survives disconnects and runs for an extended period, configure both options:Session timeouts
Learn how to extend session duration beyond the default timeout.