Overview
ThekeepAlive feature allows you to keep sessions alive across disconnects, permitting you to 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 more performant 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 will keep the session available for later use. You can 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 will 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.