O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.
O WaClientnão reconecta automaticamente. Esta é uma escolha de design deliberada: a política de reconexão (backoff, máximo de tentativas, alertas) pertence à sua aplicação. Você escuta o connection: close e decide o que fazer.
Camadas internas de recuperação
A regra “sem auto-reconnect” vale para o ciclo de vida da sessão: assim que um connection: close é emitido, o client não reabre sozinho. Mas dois retries de baixo nível existem dentro da stack – você os verá em log e não precisa tratá-los.
Transport WebSocket. Se o socket cair antes de um handshake noise bem-sucedido, o WaComms faz retry interno a cada reconnectIntervalMs (default 2000) até maxReconnectAttempts. Quando o handshake completa, o contador zera e qualquer queda posterior vira um evento connection pra sua app tratar.
Transição de pairing. Logo após um pair via QR/código, o client reinicia o socket como sessão já registrada. Nenhum connection: close é emitido – é invisível de fora.
A recuperação client_too_old (HTTP 405) coberta abaixo é uma terceira camada, opt-in.
isLogout: true — o dispositivo foi desvinculado (logout no servidor). Não reconecte; as credenciais se foram e você precisa parear novamente.
isLogout: false — uma queda transitória. É seguro reconectar com as credenciais armazenadas.
Um loop de reconexão com backoff
const MAX_ATTEMPTS = 10async function connectWithRetry(client: WaClient) { let attempt = 0 client.on('connection', (event) => { if (event.status === 'open') { attempt = 0 // reseta o backoff em uma conexão saudável 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()}
Recuperando de client_too_old (HTTP 405)
Se o servidor começar a rejeitar o handshake noise com failure_client_too_old, a versão embarcada do WA Web está desatualizada. Duas opções:
Ative recoverFromClientTooOld: true no WaClient — a cada 405 o client busca a versão atual em web.whatsapp.com, troca em memória e reconecta.
Passe um resolver version que retorne uma string fresca por conexão.
Ambos são paliativos — atualize o zapo quando uma release trouxer um default mais novo.
Depois de reconectar
Parte do estado é escopado à conexão e precisa ser reestabelecido após uma reconexão bem-sucedida:
Assinaturas de presença — faça subscribe() novamente em qualquer contato que você estava observando (Presença).
Atualizações ao vivo de newsletter — faça subscribeLiveUpdates() novamente se você depende delas.
O estado persistido (credenciais, sessões do Signal, app-state) é restaurado da store automaticamente — você não pareia novamente em uma reconexão normal.
Encerramento gracioso
Chame disconnect() para um encerramento limpo que mantém as credenciais, para que você possa retomar mais tarde:
{"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},{"name":"custom-access","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":"pt-br/guides/reconnection","slug":"/pt-br/guides/reconnection","pageMetadata":{"title":"Reconexão","description":"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.","icon":"arrows-rotate","href":"/pt-br/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: \"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.\"\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:[`O `,_jsx(_components.code,{children:`WaClient`}),` `,_jsx(_components.strong,{children:`não`}),` reconecta automaticamente. Esta é uma escolha de design deliberada: a política de reconexão (backoff, máximo de tentativas, alertas) pertence à sua aplicação. Você escuta o `,_jsx(_components.code,{children:`connection: close`}),` e decide o que fazer.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`internal-recovery-layers`,children:`Camadas internas de recuperação`}),`\n`,_jsxs(_components.p,{children:[`A regra “sem auto-reconnect” vale para o `,_jsx(_components.strong,{children:`ciclo de vida da sessão`}),`: assim que um `,_jsx(_components.code,{children:`connection: close`}),` é emitido, o client não reabre sozinho. Mas dois retries de baixo nível existem dentro da stack – você os verá em log e não precisa tratá-los.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Transport WebSocket.`}),` Se o socket cair `,_jsx(_components.em,{children:`antes`}),` de um handshake noise bem-sucedido, o `,_jsx(_components.code,{children:`WaComms`}),` faz retry interno a cada `,_jsx(_components.code,{children:`reconnectIntervalMs`}),` (default `,_jsx(_components.code,{children:`2000`}),`) até `,_jsx(_components.code,{children:`maxReconnectAttempts`}),`. Quando o handshake completa, o contador zera e qualquer queda posterior vira um evento `,_jsx(_components.code,{children:`connection`}),` pra sua app tratar.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Transição de pairing.`}),` Logo após um pair via QR/código, o client reinicia o socket como sessão já registrada. Nenhum `,_jsx(_components.code,{children:`connection: close`}),` é emitido – é invisível de fora.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`A recuperação `,_jsx(_components.code,{children:`client_too_old`}),` (HTTP 405) coberta abaixo é uma terceira camada, opt-in.`]}),`\n`,_jsx(Heading,{level:`2`,id:`connection-lifecycle`,children:`Ciclo de vida da conexão`}),`\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:`O evento connection`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`connection`}),` é uma union discriminada por `,_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:[`Em `,_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`})}),` — o dispositivo foi desvinculado (logout no servidor). `,_jsx(_components.strong,{children:`Não`}),` reconecte; as credenciais se foram e você precisa parear novamente.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`isLogout: false`})}),` — uma queda transitória. É seguro reconectar com as credenciais armazenadas.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`a-reconnection-loop-with-backoff`,children:`Um loop de reconexão com 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:` // reseta o backoff em uma conexão saudável`})]}),`\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`,children:[`Recuperando de `,_jsx(_components.code,{children:`client_too_old`}),` (HTTP 405)`]}),`\n`,_jsxs(_components.p,{children:[`Se o servidor começar a rejeitar o handshake noise com `,_jsx(_components.code,{children:`failure_client_too_old`}),`, a versão embarcada do WA Web está desatualizada. Duas opções:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Ative `,_jsx(_components.a,{href:`/pt-br/concepts/configuration#whatsapp-web-version`,children:_jsx(_components.code,{children:`recoverFromClientTooOld: true`})}),` no `,_jsx(_components.code,{children:`WaClient`}),` — a cada 405 o client busca a versão atual em `,_jsx(_components.code,{children:`web.whatsapp.com`}),`, troca em memória e reconecta.`]}),`\n`,_jsxs(_components.li,{children:[`Passe um `,_jsxs(_components.a,{href:`/pt-br/concepts/configuration#whatsapp-web-version`,children:[`resolver `,_jsx(_components.code,{children:`version`})]}),` que retorne uma string fresca por conexão.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Ambos são paliativos — atualize o zapo quando uma release trouxer um default mais novo.`}),`\n`,_jsx(Heading,{level:`2`,id:`after-reconnecting`,children:`Depois de reconectar`}),`\n`,_jsxs(_components.p,{children:[`Parte do estado é `,_jsx(_components.strong,{children:`escopado à conexão`}),` e precisa ser reestabelecido após uma reconexão bem-sucedida:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Assinaturas de presença`}),` — faça `,_jsx(_components.code,{children:`subscribe()`}),` novamente em qualquer contato que você estava observando (`,_jsx(_components.a,{href:`/pt-br/guides/presence-status#subscribing-to-a-contact`,children:`Presença`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Atualizações ao vivo de newsletter`}),` — faça `,_jsx(_components.code,{children:`subscribeLiveUpdates()`}),` novamente se você depende delas.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`O estado persistido (credenciais, sessões do Signal, `,_jsx(_components.a,{href:`/pt-br/reference/glossary#app-state`,children:`app-state`}),`) é restaurado da `,_jsx(_components.a,{href:`/pt-br/concepts/stores`,children:`store`}),` automaticamente — você `,_jsx(_components.strong,{children:`não`}),` pareia novamente em uma reconexão normal.`]}),`\n`,_jsx(Heading,{level:`2`,id:`graceful-shutdown`,children:`Encerramento gracioso`}),`\n`,_jsxs(_components.p,{children:[`Chame `,_jsx(_components.code,{children:`disconnect()`}),` para um encerramento limpo que mantém as credenciais, para que você possa retomar mais tarde:`]}),`\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:`Isso descarrega os dados pendentes de write-behind e fecha o socket sem desvincular o dispositivo.`})]})}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":"Reconexão","description":"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.","icon":"arrows-rotate","href":"/pt-br/guides/reconnection"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Camadas internas de recuperação","slug":"internal-recovery-layers","depth":2,"children":[]},{"title":"Ciclo de vida da conexão","slug":"connection-lifecycle","depth":2,"children":[]},{"title":"O evento connection","slug":"the-connection-event","depth":2,"children":[]},{"title":"Um loop de reconexão com backoff","slug":"a-reconnection-loop-with-backoff","depth":2,"children":[]},{"title":"Recuperando de client_too_old (HTTP 405)","slug":"recovering-from-client-too-old","depth":2,"children":[]},{"title":"Depois de reconectar","slug":"after-reconnecting","depth":2,"children":[]},{"title":"Encerramento gracioso","slug":"graceful-shutdown","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"beccabot-de3dfb12","siteName":"Zapo","title":"Reconexão - Zapo","contextualStarterQuestions":[{"_id":"6a6295d354a31854c239819a","deploymentId":"69fe261983b226e1d1f8a0d3","questionText":"Como tratar desconexões?","status":"active","generatedBy":"contextual","path":"pt-br/guides/reconnection","createdAt":"2026-07-23T22:29:39.715Z","updatedAt":"2026-07-23T22:29:39.715Z","__v":0},{"_id":"6a6295d354a31854c2398199","deploymentId":"69fe261983b226e1d1f8a0d3","questionText":"Qual é a política de reconexão?","status":"active","generatedBy":"contextual","path":"pt-br/guides/reconnection","createdAt":"2026-07-23T22:29:39.715Z","updatedAt":"2026-07-23T22:29:39.715Z","__v":0},{"_id":"6a6295d354a31854c2398198","deploymentId":"69fe261983b226e1d1f8a0d3","questionText":"Como detectar conexão caída?","status":"active","generatedBy":"contextual","path":"pt-br/guides/reconnection","createdAt":"2026-07-23T22:29:39.715Z","updatedAt":"2026-07-23T22:29:39.715Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/en/guides/reconnection","matchLevel":1},"pt-BR":{"href":"/pt-br/guides/reconnection","matchLevel":0}}},"lastModified":"2026-05-29T21:41:17.082Z","gitLastModified":"2026-05-29T21:41:03.000Z","originalFileLocation":"pt-br/guides/reconnection.mdx","locale":"pt-BR"},"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=\"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.\">\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=\"Reconexão - Zapo\">\u003cmeta data-mint-head property=\"og:description\" content=\"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Zapo\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://zapo.to/pt-br/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=\"Reconexão - Zapo\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.\">\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/pt-br/guides/reconnection\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/pt-br/guides/reconnection.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"pt-BR\" href=\"https://zapo.to/pt-br/guides/reconnection\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://zapo.to/en/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/pt-br/guides/reconnection#webpage\",\"url\":\"https://zapo.to/pt-br/guides/reconnection\",\"name\":\"Reconexão\",\"description\":\"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.\",\"dateModified\":\"2026-05-29T21:41:03.000Z\",\"isPartOf\":{\"@id\":\"https://zapo.to#website\"},\"breadcrumb\":{\"@id\":\"https://zapo.to/pt-br/guides/reconnection#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://zapo.to/pt-br/guides/reconnection#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guias\",\"item\":\"https://zapo.to/pt-br/guides/sending-messages\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Reconexão\",\"item\":\"https://zapo.to/pt-br/guides/reconnection\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://zapo.to/pt-br/guides/reconnection#article\",\"headline\":\"Reconexão\",\"name\":\"Reconexão\",\"description\":\"O zapo não reconecta automaticamente por design — siga este padrão para detectar sessões caídas, recriar o client e retomar sem conexões duplicadas.\",\"url\":\"https://zapo.to/pt-br/guides/reconnection\",\"mainEntityOfPage\":{\"@id\":\"https://zapo.to/pt-br/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":"/pt-br/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},"pages":[{"title":"en","href":"/en/guides/reconnection"}]},{"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},"groups":[{"group":"Primeiros passos","icon":"rocket","pages":[{"title":"Introdução","icon":"book-open","href":"/pt-br/introduction"},{"title":"Instalação","icon":"download","href":"/pt-br/installation"},{"title":"Início rápido","icon":"rocket","href":"/pt-br/quickstart"},{"title":"Migrando do Baileys","icon":"right-left","href":"/pt-br/guides/migrating-from-baileys"},{"title":"Use as docs do seu assistente de IA","sidebarTitle":"Uso com IA","icon":"robot","href":"/pt-br/use-with-ai"}]},{"group":"Conceitos","icon":"book-open","pages":[{"title":"Arquitetura","icon":"sitemap","href":"/pt-br/concepts/architecture"},{"title":"Autenticação","icon":"qrcode","href":"/pt-br/concepts/authentication"},{"title":"Identidades: números de telefone e LID","icon":"fingerprint","href":"/pt-br/concepts/identities"},{"title":"Configuração","icon":"sliders","href":"/pt-br/concepts/configuration"},{"title":"Plugins","icon":"puzzle-piece","href":"/pt-br/concepts/plugins"},{"title":"Eventos","icon":"bell","href":"/pt-br/concepts/events"},{"title":"Stores","icon":"database","href":"/pt-br/concepts/stores"}]},{"group":"Guias","icon":"map","pages":[{"group":"Mensageria","pages":[{"title":"Enviando mensagens","icon":"paper-plane","href":"/pt-br/guides/sending-messages"},{"title":"Envios proto brutos","icon":"file-code","href":"/pt-br/guides/raw-sends"},{"title":"Mídia","icon":"image","href":"/pt-br/guides/media"},{"title":"Enquetes, reações e edições","icon":"square-poll-vertical","href":"/pt-br/guides/interactive-messages"},{"title":"Recebendo mensagens","icon":"inbox","href":"/pt-br/guides/receiving-messages"}]},{"group":"Conversas","pages":[{"title":"Gerenciando chats","icon":"comments","href":"/pt-br/guides/chats"},{"title":"Grupos e comunidades","icon":"users","href":"/pt-br/guides/groups"},{"title":"Newsletters (canais)","icon":"newspaper","href":"/pt-br/guides/newsletters"},{"title":"Listas de transmissão","icon":"bullhorn","href":"/pt-br/guides/broadcast-lists"}]},{"group":"Contatos \u0026 perfil","pages":[{"title":"Bots","icon":"robot","href":"/pt-br/guides/bots"},{"title":"Presença e status","icon":"circle-dot","href":"/pt-br/guides/presence-status"},{"title":"Perfil, privacidade e business","description":"Gerencie seu perfil do WhatsApp, mude configurações de privacidade, edite a lista de bloqueio e leia perfis business e horários pelo zapo.","icon":"id-card","href":"/pt-br/guides/profile-privacy"}]},{"group":"Operações","pages":[{"title":"Reconexão","icon":"arrows-rotate","href":"/pt-br/guides/reconnection"},{"title":"Erros \u0026 desconexões","description":"Leia códigos DisconnectReason, trate falhas de stream e stanzas de erro do WhatsApp e decida quando reconectar ou encerrar a sessão de vez no zapo.","icon":"triangle-exclamation","href":"/pt-br/guides/errors"},{"title":"Deploys multi-sessão","icon":"users","href":"/pt-br/guides/multi-session"},{"title":"Produção \u0026 deploy","icon":"server","href":"/pt-br/guides/production"},{"title":"Testes end-to-end sem WhatsApp","icon":"flask-vial","href":"/pt-br/guides/e2e-testing"}]},{"group":"Extras","pages":[{"title":"Solução de problemas \u0026 FAQ","icon":"circle-question","href":"/pt-br/troubleshooting"},{"title":"Receitas","icon":"book-bookmark","href":"/pt-br/guides/recipes"}]}]},{"group":"Plugins","icon":"puzzle-piece","pages":[{"group":"VoIP","pages":[{"title":"Chamadas (VoIP)","icon":"phone","href":"/pt-br/guides/voip"},{"title":"Chamadas em grupo","icon":"users","href":"/pt-br/guides/voip-groups"},{"title":"Mídia de chamada em outro host","icon":"globe","href":"/pt-br/guides/voip-media"}]},{"title":"Telemetria WAM (paridade de analytics)","icon":"chart-line","href":"/pt-br/guides/wam"}]},{"group":"Referência","icon":"code","pages":[{"title":"WaClient \u0026 coordinators","icon":"code","href":"/pt-br/reference/client"},{"title":"Tipos de mensagem","icon":"layer-group","href":"/pt-br/reference/message-types"},{"title":"Mutações de chat (app-state)","icon":"list-check","href":"/pt-br/reference/chat-mutations"},{"title":"API de baixo nível","icon":"terminal","href":"/pt-br/reference/low-level"},{"title":"Referência de stores","icon":"database","href":"/pt-br/reference/stores"},{"title":"JIDs, helpers e constantes","icon":"at","href":"/pt-br/reference/jid-helpers"},{"title":"Glossário","icon":"book","href":"/pt-br/reference/glossary"}]},{"group":"Avançado","icon":"layer-group","pages":[{"title":"O protocolo do WhatsApp","icon":"diagram-project","href":"/pt-br/concepts/protocol"},{"title":"Arquitetura em profundidade","icon":"layer-group","href":"/pt-br/concepts/internals"},{"title":"Conexões mobile","icon":"mobile","href":"/pt-br/concepts/mobile"},{"title":"Ferramentas de dev (MCP \u0026 fake server)","sidebarTitle":"Ferramentas de dev","icon":"screwdriver-wrench","tag":"Dev","href":"/pt-br/dev-tools"}]},{"group":"Engenharia reversa","icon":"microscope","pages":[{"title":"Passkey \u0026 linking Shortcake do WhatsApp","icon":"key","href":"/pt-br/reverse-engineering/passkey-linking"}]}]}]},"basePath":"","title":"Reconexão - 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"]}