zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.
WaClient does not reconnect automatically. This is a deliberate design choice: reconnection policy (backoff, max retries, alerting) belongs to your application. You listen for connection: close and decide what to do.
Internal recovery layers
The “no auto-reconnect” rule applies to the session lifecycle: once a connection: close event fires, the client will not reopen by itself. Two lower-level retries do live inside the stack though – you will see them in logs and you do not need to handle them.
WebSocket transport. If the socket drops before a successful noise handshake, WaComms retries internally every reconnectIntervalMs (default 2000) up to maxReconnectAttempts. Once the handshake completes, the counter resets and any subsequent drop surfaces as a connection event for your app to handle.
Pairing transition. Right after a QR/code pair succeeds, the client restarts the socket as a registered session. No connection: close event fires for this – it is invisible from the outside.
The client_too_old (HTTP 405) recovery covered below is a third, opt-in layer.
isLogout: true — the device was unlinked (server-side logout). Do not reconnect; the credentials are gone and you must re-pair.
isLogout: false — a transient drop. Safe to reconnect with the stored credentials.
A reconnection loop with backoff
const MAX_ATTEMPTS = 10async function connectWithRetry(client: WaClient) { let attempt = 0 client.on('connection', (event) => { if (event.status === 'open') { attempt = 0 // reset backoff on a healthy connection return } if (event.isLogout) { console.error('logged out — re-pairing required') return } void reconnect() }) async function reconnect() { if (attempt >= MAX_ATTEMPTS) { console.error('giving up after', attempt, 'attempts') return } const delayMs = Math.min(30_000, 1_000 * 2 ** attempt) attempt += 1 console.log(`reconnecting in ${delayMs}ms (attempt ${attempt})`) await new Promise((r) => setTimeout(r, delayMs)) try { await client.connect() } catch (err) { console.error('reconnect failed', err) void reconnect() } } await client.connect()}
Recovering from client_too_old (HTTP 405)
If the server starts rejecting the noise handshake with failure_client_too_old, the bundled WA Web version is out of date. Two options:
Set recoverFromClientTooOld: true on WaClient — on every 405 the client fetches the current version from web.whatsapp.com, swaps it in, and reconnects.
Pass a version resolver that returns a fresh string per connect.
Both are stopgaps — upgrade zapo when a release ships with a refreshed default.
After reconnecting
Some state is connection-scoped and must be re-established after a successful reconnect:
Presence subscriptions — re-subscribe() to any contacts you were watching (Presence).
Newsletter live updates — re-subscribeLiveUpdates() if you rely on them.
Persisted state (credentials, Signal sessions, app-state) is restored from the store automatically — you do not re-pair on a normal reconnect.
Graceful shutdown
Call disconnect() for a clean shutdown that keeps credentials so you can resume later:
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Zapo","colors":{"primary":"#16A338","light":"#2BC54E","dark":"#12802F"},"logo":"https://mintcdn.com/beccabot-de3dfb12/0P_n4xRsGyoRYIz4/logo/zapo-header.png?fit=max\u0026auto=format\u0026n=0P_n4xRsGyoRYIz4\u0026q=85\u0026s=b27a62b23ee5779b3b739c10c894538a","favicon":"https://mintcdn.com/beccabot-de3dfb12/0P_n4xRsGyoRYIz4/favicon.png?fit=max\u0026auto=format\u0026n=0P_n4xRsGyoRYIz4\u0026q=85\u0026s=38f02b3df456dc52c97cef78500156ad","background":{"decoration":"gradient"},"navbar":{"links":[{"icon":"npm","href":"https://www.npmjs.com/package/zapo-js","label":"npm"},{"icon":"heart","href":"https://github.com/sponsors/vinikjkkj","label":"Sponsor"}],"primary":{"type":"github","href":"https://github.com/vinikjkkj/zapo"}},"footer":{"socials":{"github":"https://github.com/vinikjkkj/zapo"}},"search":{"prompt":"Search the Zapo docs..."},"seo":{"metatags":{"og:site_name":"Zapo","og:type":"website","og:image":"https://zapo.to/images/og.png","twitter:card":"summary_large_image","twitter:image":"https://zapo.to/images/og.png"}},"icons":{"library":"fontawesome"},"styling":{"eyebrows":"breadcrumbs","latex":false},"contextual":{"options":["copy","view","chatgpt","claude","cursor","mcp"],"display":"header"},"metadata":{"timestamp":true},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/vinikjkkj/zapo"},{"anchor":"npm","icon":"npm","href":"https://www.npmjs.com/package/zapo-js"},{"anchor":"Sponsor","icon":"heart","href":"https://github.com/sponsors/vinikjkkj"}]},"languages":[{"language":"en","banner":{"content":"🎉 zapo 1.0 is here — the first stable release, following semantic versioning. [Learn more](/en/introduction)","dismissible":true},"href":"en/introduction"},{"language":"pt-BR","banner":{"content":"🎉 zapo 1.0 chegou — o primeiro release estável, seguindo versionamento semântico. [Saiba mais](/pt-br/introduction)","dismissible":true},"href":"pt-br/introduction"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"beccabot-de3dfb12","hasAudioNarration":false,"actualSubdomain":"beccabot-de3dfb12","customDomains":["zapo.to"],"gitSource":{"type":"github","owner":"vinikjkkj","repo":"zapo-docs","deployBranch":"master","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"issues":true,"thumbs":true,"edits":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6ae227286348b326c6fa65e2","clientVersion":"0.0.4352","searchFilterCounts":[{"language":"en","tag":"Guides","count":19},{"language":"pt-BR","tag":"Guias","count":19},{"language":"en","tag":"Core concepts","count":7},{"language":"en","tag":"Reference","count":7},{"language":"pt-BR","tag":"Conceitos","count":7},{"language":"pt-BR","tag":"Referência","count":7},{"language":"en","tag":"Operations","count":5},{"language":"en","tag":"Messaging","count":5},{"language":"en","tag":"Getting started","count":5},{"language":"pt-BR","tag":"Operações","count":5},{"language":"pt-BR","tag":"Mensageria","count":5},{"language":"pt-BR","tag":"Primeiros passos","count":5},{"language":"en","tag":"Advanced","count":4},{"language":"en","tag":"Conversations","count":4},{"language":"en","tag":"Plugins","count":4},{"language":"pt-BR","tag":"Avançado","count":4},{"language":"pt-BR","tag":"Conversas","count":4},{"language":"pt-BR","tag":"Plugins","count":4},{"language":"en","tag":"Peers \u0026 profile","count":3},{"language":"pt-BR","tag":"Contatos \u0026 perfil","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"*{scrollbar-width:thin;scrollbar-color:rgba(22, 163, 56, 0.55) transparent}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background-color:rgba(22, 163, 56, 0.5);border-radius:9999px;border:2px solid transparent;background-clip:content-box}::-webkit-scrollbar-thumb:hover{background-color:rgba(22, 163, 56, 0.85);background-clip:content-box}::-webkit-scrollbar-corner{background:transparent}#banner{background:rgba(22, 163, 56, 0.12);color:#14532d;border-bottom:1px solid rgba(22, 163, 56, 0.3)}#banner a{color:#166a25;text-decoration:underline}.dark #banner{background:rgba(22, 163, 56, 0.18);color:#86efac;border-bottom-color:rgba(22, 163, 56, 0.4)}.dark #banner a{color:#bbf7d0}"}]}
{"page":{"pagePath":"en/guides/reconnection","slug":"/en/guides/reconnection","pageMetadata":{"title":"Reconnection","description":"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.","icon":"arrows-rotate","href":"/en/guides/reconnection"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Mermaid,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Mermaid)_missingMdxReference(`Mermaid`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`WaClient`}),` does `,_jsx(_components.strong,{children:`not`}),` reconnect automatically. This is a deliberate design choice: reconnection policy (backoff, max retries, alerting) belongs to your application. You listen for `,_jsx(_components.code,{children:`connection: close`}),` and decide what to do.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`internal-recovery-layers`,children:`Internal recovery layers`}),`\n`,_jsxs(_components.p,{children:[`The “no auto-reconnect” rule applies to the `,_jsx(_components.strong,{children:`session lifecycle`}),`: once a `,_jsx(_components.code,{children:`connection: close`}),` event fires, the client will not reopen by itself. Two lower-level retries do live inside the stack though – you will see them in logs and you do not need to handle them.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`WebSocket transport.`}),` If the socket drops `,_jsx(_components.em,{children:`before`}),` a successful noise handshake, `,_jsx(_components.code,{children:`WaComms`}),` retries internally every `,_jsx(_components.code,{children:`reconnectIntervalMs`}),` (default `,_jsx(_components.code,{children:`2000`}),`) up to `,_jsx(_components.code,{children:`maxReconnectAttempts`}),`. Once the handshake completes, the counter resets and any subsequent drop surfaces as a `,_jsx(_components.code,{children:`connection`}),` event for your app to handle.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Pairing transition.`}),` Right after a QR/code pair succeeds, the client restarts the socket as a registered session. No `,_jsx(_components.code,{children:`connection: close`}),` event fires for this – it is invisible from the outside.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`client_too_old`}),` (HTTP 405) recovery covered below is a third, opt-in layer.`]}),`\n`,_jsx(Heading,{level:`2`,id:`connection-lifecycle`,children:`Connection lifecycle`}),`\n`,_jsx(Mermaid,{chart:`stateDiagram-v2\n [*] --> Connecting: connect()\n Connecting --> Open: opened\n Connecting --> Closed: failed\n Open --> Closed: connection close\n Closed --> Connecting: reconnect (isLogout = false)\n Open --> [*]: disconnect()\n Closed --> [*]: isLogout = true (re-pair)`}),`\n`,_jsx(Heading,{level:`2`,id:`the-connection-event`,children:`The connection event`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`connection`}),` is a discriminated union on `,_jsx(_components.code,{children:`status`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`13`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'connection'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'open'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'connected'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`isNewLogin:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`isNewLogin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // status === 'close'`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'disconnected'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` reason:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`reason`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` code:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`code`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` isLogout:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`isLogout`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`On `,_jsx(_components.code,{children:`close`}),`:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`isLogout: true`})}),` — the device was unlinked (server-side logout). Do `,_jsx(_components.strong,{children:`not`}),` reconnect; the credentials are gone and you must re-pair.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`isLogout: false`})}),` — a transient drop. Safe to reconnect with the stored credentials.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`a-reconnection-loop-with-backoff`,children:`A reconnection loop with backoff`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`36`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`36`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MAX_ATTEMPTS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` connectWithRetry`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` WaClient`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` attempt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'connection'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`status`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'open'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` attempt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // reset backoff on a healthy connection`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`isLogout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'logged out — re-pairing required'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` void`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reconnect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` })`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reconnect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`attempt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` MAX_ATTEMPTS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'giving up after'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`attempt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'attempts'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` delayMs`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Math`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`min`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`30_000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1_000`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` **`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` attempt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` attempt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`reconnecting in \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delayMs`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`ms (attempt `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`attempt`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\")`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` Promise`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` setTimeout`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`r`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`delayMs`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` try`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`connect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'reconnect failed'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`err`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` void`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` reconnect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`connect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(Heading,{level:`2`,id:`recovering-from-client_too_old-http-405`,children:[`Recovering from `,_jsx(_components.code,{children:`client_too_old`}),` (HTTP 405)`]}),`\n`,_jsxs(_components.p,{children:[`If the server starts rejecting the noise handshake with `,_jsx(_components.code,{children:`failure_client_too_old`}),`, the bundled WA Web version is out of date. Two options:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Set `,_jsx(_components.a,{href:`/en/concepts/configuration#whatsapp-web-version`,children:_jsx(_components.code,{children:`recoverFromClientTooOld: true`})}),` on `,_jsx(_components.code,{children:`WaClient`}),` — on every 405 the client fetches the current version from `,_jsx(_components.code,{children:`web.whatsapp.com`}),`, swaps it in, and reconnects.`]}),`\n`,_jsxs(_components.li,{children:[`Pass a `,_jsxs(_components.a,{href:`/en/concepts/configuration#whatsapp-web-version`,children:[_jsx(_components.code,{children:`version`}),` resolver`]}),` that returns a fresh string per connect.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Both are stopgaps — upgrade zapo when a release ships with a refreshed default.`}),`\n`,_jsx(Heading,{level:`2`,id:`after-reconnecting`,children:`After reconnecting`}),`\n`,_jsxs(_components.p,{children:[`Some state is `,_jsx(_components.strong,{children:`connection-scoped`}),` and must be re-established after a successful reconnect:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Presence subscriptions`}),` — re-`,_jsx(_components.code,{children:`subscribe()`}),` to any contacts you were watching (`,_jsx(_components.a,{href:`/en/guides/presence-status#subscribing-to-a-contact`,children:`Presence`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Newsletter live updates`}),` — re-`,_jsx(_components.code,{children:`subscribeLiveUpdates()`}),` if you rely on them.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Persisted state (credentials, Signal sessions, `,_jsx(_components.a,{href:`/en/reference/glossary#app-state`,children:`app-state`}),`) is restored from the `,_jsx(_components.a,{href:`/en/concepts/stores`,children:`store`}),` automatically — you do `,_jsx(_components.strong,{children:`not`}),` re-pair on a normal reconnect.`]}),`\n`,_jsx(Heading,{level:`2`,id:`graceful-shutdown`,children:`Graceful shutdown`}),`\n`,_jsxs(_components.p,{children:[`Call `,_jsx(_components.code,{children:`disconnect()`}),` for a clean shutdown that keeps credentials so you can resume later:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'SIGINT'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`disconnect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` process`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`exit`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`})`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`This flushes pending write-behind data and closes the socket without unlinking the device.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Reconnection","description":"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.","icon":"arrows-rotate","href":"/en/guides/reconnection"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Internal recovery layers","slug":"internal-recovery-layers","depth":2,"children":[]},{"title":"Connection lifecycle","slug":"connection-lifecycle","depth":2,"children":[]},{"title":"The connection event","slug":"the-connection-event","depth":2,"children":[]},{"title":"A reconnection loop with backoff","slug":"a-reconnection-loop-with-backoff","depth":2,"children":[]},{"title":"Recovering from client_too_old (HTTP 405)","slug":"recovering-from-client_too_old-http-405","depth":2,"children":[]},{"title":"After reconnecting","slug":"after-reconnecting","depth":2,"children":[]},{"title":"Graceful shutdown","slug":"graceful-shutdown","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"beccabot-de3dfb12","siteName":"Zapo","title":"Reconnection - Zapo","contextualStarterQuestions":[{"_id":"6a6295cc54a31854c2398027","deploymentId":"69fe261983b226e1d1f8a0d3","questionText":"What triggers a connection close?","status":"active","generatedBy":"contextual","path":"en/guides/reconnection","createdAt":"2026-07-23T22:29:32.663Z","updatedAt":"2026-07-23T22:29:32.663Z","__v":0},{"_id":"6a6295cc54a31854c2398026","deploymentId":"69fe261983b226e1d1f8a0d3","questionText":"How do I handle reconnection?","status":"active","generatedBy":"contextual","path":"en/guides/reconnection","createdAt":"2026-07-23T22:29:32.663Z","updatedAt":"2026-07-23T22:29:32.663Z","__v":0},{"_id":"6a6295cc54a31854c2398028","deploymentId":"69fe261983b226e1d1f8a0d3","questionText":"Does zapo auto-reconnect?","status":"active","generatedBy":"contextual","path":"en/guides/reconnection","createdAt":"2026-07-23T22:29:32.663Z","updatedAt":"2026-07-23T22:29:32.663Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/en/guides/reconnection","matchLevel":0},"pt-BR":{"href":"/pt-br/guides/reconnection","matchLevel":1}}},"lastModified":"2026-05-29T21:41:17.083Z","gitLastModified":"2026-05-29T21:41:03.000Z","originalFileLocation":"en/guides/reconnection.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Zapo\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Reconnection - Zapo\">\u003cmeta data-mint-head property=\"og:description\" content=\"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Zapo\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://zapo.to/en/guides/reconnection\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://zapo.to/images/og.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Reconnection - Zapo\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://zapo.to/images/og.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/beccabot-de3dfb12/ygGNKj5KrEmRMM4_/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Zapo\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#16A338\">\u003clink data-mint-head rel=\"canonical\" href=\"https://zapo.to/en/guides/reconnection\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/en/guides/reconnection.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://zapo.to/en/guides/reconnection\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"pt-BR\" href=\"https://zapo.to/pt-br/guides/reconnection\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://zapo.to/en/guides/reconnection\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://zapo.to/#organization\",\"name\":\"Zapo\",\"url\":\"https://zapo.to\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/beccabot-de3dfb12/0P_n4xRsGyoRYIz4/logo/zapo-header.png?fit=max\u0026auto=format\u0026n=0P_n4xRsGyoRYIz4\u0026q=85\u0026s=b27a62b23ee5779b3b739c10c894538a\"}},{\"@type\":\"WebSite\",\"@id\":\"https://zapo.to#website\",\"name\":\"Zapo\",\"url\":\"https://zapo.to\",\"publisher\":{\"@id\":\"https://zapo.to/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://zapo.to/en/guides/reconnection#webpage\",\"url\":\"https://zapo.to/en/guides/reconnection\",\"name\":\"Reconnection\",\"description\":\"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.\",\"dateModified\":\"2026-05-29T21:41:03.000Z\",\"isPartOf\":{\"@id\":\"https://zapo.to#website\"},\"breadcrumb\":{\"@id\":\"https://zapo.to/en/guides/reconnection#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://zapo.to/en/guides/reconnection#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://zapo.to/en/guides/sending-messages\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Reconnection\",\"item\":\"https://zapo.to/en/guides/reconnection\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://zapo.to/en/guides/reconnection#article\",\"headline\":\"Reconnection\",\"name\":\"Reconnection\",\"description\":\"zapo does not auto-reconnect by design — follow this pattern to detect dropped sessions, rebuild the client, and resume without duplicate connections.\",\"url\":\"https://zapo.to/en/guides/reconnection\",\"mainEntityOfPage\":{\"@id\":\"https://zapo.to/en/guides/reconnection#webpage\"},\"image\":\"https://zapo.to/images/og.png\",\"dateModified\":\"2026-05-29T21:41:03.000Z\",\"publisher\":{\"@id\":\"https://zapo.to/#organization\"},\"isPartOf\":{\"@id\":\"https://zapo.to#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Zapo\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Zapo\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/en/guides/reconnection.md","siteName":"Zapo","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/vinikjkkj/zapo"},{"anchor":"npm","icon":"npm","href":"https://www.npmjs.com/package/zapo-js"},{"anchor":"Sponsor","icon":"heart","href":"https://github.com/sponsors/vinikjkkj"}]},"languages":[{"language":"en","banner":{"content":"🎉 zapo 1.0 is here — the first stable release, following semantic versioning. [Learn more](/en/introduction)","dismissible":true},"groups":[{"group":"Getting started","icon":"rocket","pages":[{"title":"Introduction","icon":"book-open","href":"/en/introduction"},{"title":"Installation","icon":"download","href":"/en/installation"},{"title":"Quickstart","icon":"rocket","href":"/en/quickstart"},{"title":"Migrating from Baileys","icon":"right-left","href":"/en/guides/migrating-from-baileys"},{"title":"Use the docs from your AI assistant","sidebarTitle":"Use with AI","icon":"robot","href":"/en/use-with-ai"}]},{"group":"Core concepts","icon":"book-open","pages":[{"title":"Architecture","icon":"sitemap","href":"/en/concepts/architecture"},{"title":"Authentication","icon":"qrcode","href":"/en/concepts/authentication"},{"title":"Identities: phone numbers \u0026 LID","icon":"fingerprint","href":"/en/concepts/identities"},{"title":"Configuration","icon":"sliders","href":"/en/concepts/configuration"},{"title":"Plugins","icon":"puzzle-piece","href":"/en/concepts/plugins"},{"title":"Events","icon":"bell","href":"/en/concepts/events"},{"title":"Stores","icon":"database","href":"/en/concepts/stores"}]},{"group":"Guides","icon":"map","pages":[{"group":"Messaging","pages":[{"title":"Sending messages","icon":"paper-plane","href":"/en/guides/sending-messages"},{"title":"Raw proto sends","icon":"file-code","href":"/en/guides/raw-sends"},{"title":"Media","icon":"image","href":"/en/guides/media"},{"title":"Polls, reactions \u0026 edits","icon":"square-poll-vertical","href":"/en/guides/interactive-messages"},{"title":"Receiving messages","icon":"inbox","href":"/en/guides/receiving-messages"}]},{"group":"Conversations","pages":[{"title":"Managing chats","icon":"comments","href":"/en/guides/chats"},{"title":"Groups \u0026 communities","icon":"users","href":"/en/guides/groups"},{"title":"Newsletters (channels)","icon":"newspaper","href":"/en/guides/newsletters"},{"title":"Broadcast lists","icon":"bullhorn","href":"/en/guides/broadcast-lists"}]},{"group":"Peers \u0026 profile","pages":[{"title":"Bots","icon":"robot","href":"/en/guides/bots"},{"title":"Presence \u0026 status","icon":"circle-dot","href":"/en/guides/presence-status"},{"title":"Profile, privacy \u0026 business","description":"Manage your WhatsApp profile, change privacy settings, edit the blocklist, and read business profiles and hours with the profile coordinator.","icon":"id-card","href":"/en/guides/profile-privacy"}]},{"group":"Operations","pages":[{"title":"Reconnection","icon":"arrows-rotate","href":"/en/guides/reconnection"},{"title":"Errors \u0026 disconnects","description":"Read DisconnectReason codes, handle stream failures and error stanzas from WhatsApp, and decide when to reconnect versus stop the session for good.","icon":"triangle-exclamation","href":"/en/guides/errors"},{"title":"Multi-session deployments","icon":"users","href":"/en/guides/multi-session"},{"title":"Production \u0026 deployment","icon":"server","href":"/en/guides/production"},{"title":"End-to-end testing without WhatsApp","icon":"flask-vial","href":"/en/guides/e2e-testing"}]},{"group":"Extras","pages":[{"title":"Troubleshooting \u0026 FAQ","icon":"circle-question","href":"/en/troubleshooting"},{"title":"Recipes","icon":"book-bookmark","href":"/en/guides/recipes"}]}]},{"group":"Plugins","icon":"puzzle-piece","pages":[{"group":"VoIP","pages":[{"title":"Calls (VoIP)","icon":"phone","href":"/en/guides/voip"},{"title":"Group calls","icon":"users","href":"/en/guides/voip-groups"},{"title":"Call media on another host","icon":"globe","href":"/en/guides/voip-media"}]},{"title":"WAM telemetry (analytics parity)","icon":"chart-line","href":"/en/guides/wam"}]},{"group":"Reference","icon":"code","pages":[{"title":"WaClient \u0026 coordinators","icon":"code","href":"/en/reference/client"},{"title":"Message types","icon":"layer-group","href":"/en/reference/message-types"},{"title":"Chat mutations (app-state)","icon":"list-check","href":"/en/reference/chat-mutations"},{"title":"Low-level API","icon":"terminal","href":"/en/reference/low-level"},{"title":"Stores reference","icon":"database","href":"/en/reference/stores"},{"title":"JIDs, helpers \u0026 constants","icon":"at","href":"/en/reference/jid-helpers"},{"title":"Glossary","icon":"book","href":"/en/reference/glossary"}]},{"group":"Advanced","icon":"layer-group","pages":[{"title":"The WhatsApp protocol","icon":"diagram-project","href":"/en/concepts/protocol"},{"title":"Architecture in depth","icon":"layer-group","href":"/en/concepts/internals"},{"title":"Mobile connections","icon":"mobile","href":"/en/concepts/mobile"},{"title":"Dev tools (MCP \u0026 fake server)","sidebarTitle":"Dev tools","icon":"screwdriver-wrench","tag":"Dev","href":"/en/dev-tools"}]},{"group":"Reverse engineering","icon":"microscope","pages":[{"title":"WhatsApp passkey \u0026 Shortcake linking","icon":"key","href":"/en/reverse-engineering/passkey-linking"}]}]},{"language":"pt-BR","banner":{"content":"🎉 zapo 1.0 chegou — o primeiro release estável, seguindo versionamento semântico. [Saiba mais](/pt-br/introduction)","dismissible":true},"pages":[{"title":"pt-BR","href":"/pt-br/guides/reconnection"}]}]},"basePath":"","title":"Reconnection - Zapo","deploymentId":"dpl_5nNsUVHqbVdUHouroPPzwztSbjmH","buildId":"dpl_5nNsUVHqbVdUHouroPPzwztSbjmH","dynamics":["10e4515597"],"chunks":["BannerMarkdown-DJLtvPWC.js","dist-CAcI43Vk.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}