[{"data":1,"prerenderedAt":845},["ShallowReactive",2],{"navigation":3,"\u002Fclient\u002Fconnection-state":129,"\u002Fclient\u002Fconnection-state-surround":840},[4,27,65,107,125],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":26},"Getting started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,14,18,22],{"title":11,"path":12,"stem":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction",{"title":15,"path":16,"stem":17},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation",{"title":19,"path":20,"stem":21},"Quick start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start",{"title":23,"path":24,"stem":25},"MSRV","\u002Fgetting-started\u002Fmsrv","1.getting-started\u002F9.msrv",false,{"title":28,"icon":29,"path":30,"stem":31,"children":32,"page":26},"Client","i-lucide-plug-zap","\u002Fclient","2.client",[33,37,41,45,49,53,57,61],{"title":34,"path":35,"stem":36},"Configuration","\u002Fclient\u002Fconfiguration","2.client\u002F1.configuration",{"title":38,"path":39,"stem":40},"Events and acks","\u002Fclient\u002Fevents-and-acks","2.client\u002F2.events-and-acks",{"title":42,"path":43,"stem":44},"Connection state","\u002Fclient\u002Fconnection-state","2.client\u002F3.connection-state",{"title":46,"path":47,"stem":48},"Transports and proxies","\u002Fclient\u002Ftransports-and-proxies","2.client\u002F4.transports-and-proxies",{"title":50,"path":51,"stem":52},"TLS","\u002Fclient\u002Ftls","2.client\u002F5.tls",{"title":54,"path":55,"stem":56},"Errors","\u002Fclient\u002Ferrors","2.client\u002F6.errors",{"title":58,"path":59,"stem":60},"Debugging","\u002Fclient\u002Fdebugging","2.client\u002F7.debugging",{"title":62,"path":63,"stem":64},"Blocking client","\u002Fclient\u002Fblocking","2.client\u002F8.blocking",{"title":66,"icon":67,"path":68,"stem":69,"children":70,"page":26},"Tauri plugin","i-simple-icons-tauri","\u002Ftauri","3.tauri",[71,75,79,83,87,91,95,99,103],{"title":72,"path":73,"stem":74},"Setup","\u002Ftauri\u002Fsetup","3.tauri\u002F1.setup",{"title":76,"path":77,"stem":78},"JavaScript API","\u002Ftauri\u002Fjavascript-api","3.tauri\u002F2.javascript-api",{"title":80,"path":81,"stem":82},"Rust API","\u002Ftauri\u002Frust-api","3.tauri\u002F3.rust-api",{"title":84,"path":85,"stem":86},"Permissions","\u002Ftauri\u002Fpermissions","3.tauri\u002F4.permissions",{"title":88,"path":89,"stem":90},"Security","\u002Ftauri\u002Fsecurity","3.tauri\u002F5.security",{"title":92,"path":93,"stem":94},"Messages and errors","\u002Ftauri\u002Fmessages-and-errors","3.tauri\u002F6.messages-and-errors",{"title":96,"path":97,"stem":98},"Troubleshooting","\u002Ftauri\u002Ftroubleshooting","3.tauri\u002F7.troubleshooting",{"title":100,"path":101,"stem":102},"Example app","\u002Ftauri\u002Fexample","3.tauri\u002F8.example",{"title":104,"path":105,"stem":106},"Plugin changelog","\u002Ftauri\u002Fchangelog","3.tauri\u002F9.changelog",{"title":108,"icon":109,"path":110,"stem":111,"children":112,"page":26},"Guides","i-lucide-book-open","\u002Fguides","4.guides",[113,117,121],{"title":114,"path":115,"stem":116},"Migration from rust_socketio","\u002Fguides\u002Fmigration","4.guides\u002F1.migration",{"title":118,"path":119,"stem":120},"Comparison","\u002Fguides\u002Fcomparison","4.guides\u002F2.comparison",{"title":122,"path":123,"stem":124},"Contributing","\u002Fguides\u002Fcontributing","4.guides\u002F3.contributing",{"title":126,"path":127,"stem":128},"Changelog","\u002Fchangelog","9.changelog",{"id":130,"title":42,"body":131,"description":833,"extension":834,"links":835,"meta":836,"navigation":837,"path":43,"seo":838,"stem":44,"__hash__":839},"docs\u002F2.client\u002F3.connection-state.md",{"type":132,"value":133,"toc":825},"minimark",[134,139,266,341,348,352,362,522,536,540,550,680,684,693,697,720,805,809,821],[135,136,138],"h2",{"id":137},"states","States",[140,141,146],"pre",{"className":142,"code":143,"language":144,"meta":145,"style":145},"language-rust shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pub enum ConnectionState {\n    Connecting { attempt },\n    Connected { sid, recovered },\n    Disconnected { reason, error },\n    Reconnecting { attempt, delay, error },\n    Closed { reason, error },\n}\n","rust","",[147,148,149,169,185,204,222,244,260],"code",{"__ignoreMap":145},[150,151,154,158,161,165],"span",{"class":152,"line":153},"line",1,[150,155,157],{"class":156},"spNyl","pub",[150,159,160],{"class":156}," enum",[150,162,164],{"class":163},"sBMFI"," ConnectionState",[150,166,168],{"class":167},"sMK4o"," {\n",[150,170,172,175,178,182],{"class":152,"line":171},2,[150,173,174],{"class":163},"    Connecting",[150,176,177],{"class":167}," {",[150,179,181],{"class":180},"sTEyZ"," attempt ",[150,183,184],{"class":167},"},\n",[150,186,188,191,193,196,199,202],{"class":152,"line":187},3,[150,189,190],{"class":163},"    Connected",[150,192,177],{"class":167},[150,194,195],{"class":180}," sid",[150,197,198],{"class":167},",",[150,200,201],{"class":180}," recovered ",[150,203,184],{"class":167},[150,205,207,210,212,215,217,220],{"class":152,"line":206},4,[150,208,209],{"class":163},"    Disconnected",[150,211,177],{"class":167},[150,213,214],{"class":180}," reason",[150,216,198],{"class":167},[150,218,219],{"class":180}," error ",[150,221,184],{"class":167},[150,223,225,228,230,233,235,238,240,242],{"class":152,"line":224},5,[150,226,227],{"class":163},"    Reconnecting",[150,229,177],{"class":167},[150,231,232],{"class":180}," attempt",[150,234,198],{"class":167},[150,236,237],{"class":180}," delay",[150,239,198],{"class":167},[150,241,219],{"class":180},[150,243,184],{"class":167},[150,245,247,250,252,254,256,258],{"class":152,"line":246},6,[150,248,249],{"class":163},"    Closed",[150,251,177],{"class":167},[150,253,214],{"class":180},[150,255,198],{"class":167},[150,257,219],{"class":180},[150,259,184],{"class":167},[150,261,263],{"class":152,"line":262},7,[150,264,265],{"class":167},"}\n",[267,268,269,282],"table",{},[270,271,272],"thead",{},[273,274,275,279],"tr",{},[276,277,278],"th",{},"Read it",[276,280,281],{},"How",[283,284,285,306,316,331],"tbody",{},[273,286,287,291],{},[288,289,290],"td",{},"now",[288,292,293,296,297,296,300,296,303],{},[147,294,295],{},"client.state()",", ",[147,298,299],{},"client.connected()",[147,301,302],{},"client.id()",[147,304,305],{},"client.recovered()",[273,307,308,311],{},[288,309,310],{},"wait",[288,312,313],{},[147,314,315],{},"client.wait_for(|s| s.is_connected()).await",[273,317,318,321],{},[288,319,320],{},"watch",[288,322,323,326,327,330],{},[147,324,325],{},"client.state_watch()"," (a ",[147,328,329],{},"tokio::sync::watch::Receiver",")",[273,332,333,336],{},[288,334,335],{},"every transition, in order with the events",[288,337,338],{},[147,339,340],{},"on_state_change(|state, client| ..)",[342,343,344,347],"p",{},[147,345,346],{},"Connected { recovered: true }"," means the server restored the session (connection state recovery: the missed packets were replayed, the socket id kept).",[135,349,351],{"id":350},"disconnect-reasons","Disconnect reasons",[342,353,354,357,358,361],{},[147,355,356],{},"DisconnectReason"," has socket.io-client's reasons plus three of its own; ",[147,359,360],{},"reason.as_str()"," gives the string.",[267,363,364,377],{},[270,365,366],{},[273,367,368,371,374],{},[276,369,370],{},"Reason",[276,372,373],{},"String",[276,375,376],{},"When",[283,378,379,397,414,429,444,459,474,489,504],{},[273,380,381,386,391],{},[288,382,383],{},[147,384,385],{},"IoServerDisconnect",[288,387,388],{},[147,389,390],{},"io server disconnect",[288,392,393,394],{},"the server called ",[147,395,396],{},"socket.disconnect()",[273,398,399,404,409],{},[288,400,401],{},[147,402,403],{},"IoClientDisconnect",[288,405,406],{},[147,407,408],{},"io client disconnect",[288,410,411],{},[147,412,413],{},"client.disconnect()",[273,415,416,421,426],{},[288,417,418],{},[147,419,420],{},"PingTimeout",[288,422,423],{},[147,424,425],{},"ping timeout",[288,427,428],{},"no ping within pingInterval + pingTimeout",[273,430,431,436,441],{},[288,432,433],{},[147,434,435],{},"TransportClose",[288,437,438],{},[147,439,440],{},"transport close",[288,442,443],{},"the connection was closed",[273,445,446,451,456],{},[288,447,448],{},[147,449,450],{},"TransportError",[288,452,453],{},[147,454,455],{},"transport error",[288,457,458],{},"the connection failed",[273,460,461,466,471],{},[288,462,463],{},[147,464,465],{},"ParseError",[288,467,468],{},[147,469,470],{},"parse error",[288,472,473],{},"the server sent an undecodable packet",[273,475,476,481,486],{},[288,477,478],{},[147,479,480],{},"ConnectRejected",[288,482,483],{},[147,484,485],{},"connect rejected",[288,487,488],{},"the namespace refused the CONNECT (no retry)",[273,490,491,496,501],{},[288,492,493],{},[147,494,495],{},"ReconnectFailed",[288,497,498],{},[147,499,500],{},"reconnect failed",[288,502,503],{},"reconnection attempts used up",[273,505,506,511,516],{},[288,507,508],{},[147,509,510],{},"Dropped",[288,512,513],{},[147,514,515],{},"client dropped",[288,517,518,519,521],{},"the last ",[147,520,28],{}," was dropped",[342,523,524,527,528,531,532,535],{},[147,525,526],{},"Disconnected { reason, error }"," and ",[147,529,530],{},"Closed { reason, error }"," carry the error that ended the connection, such as ",[147,533,534],{},"WebsocketClosed { code, reason }"," from a close frame.",[135,537,539],{"id":538},"link-info","Link info",[342,541,542,545,546,549],{},[147,543,544],{},"client.link_info()"," returns a ",[147,547,548],{},"LinkInfo"," snapshot:",[267,551,552,562],{},[270,553,554],{},[273,555,556,559],{},[276,557,558],{},"Field",[276,560,561],{},"What",[283,563,564,577,590,606,628,638,651,670],{},[273,565,566,574],{},[288,567,568,296,571],{},[147,569,570],{},"sid",[147,572,573],{},"engine_sid",[288,575,576],{},"socket id and engine.io session id while connected",[273,578,579,584],{},[288,580,581],{},[147,582,583],{},"transport",[288,585,586,589],{},[147,587,588],{},"TransportKind"," in use",[273,591,592,603],{},[288,593,594,296,597,296,600],{},[147,595,596],{},"ping_interval",[147,598,599],{},"ping_timeout",[147,601,602],{},"max_payload",[288,604,605],{},"from the last handshake",[273,607,608,622],{},[288,609,610,296,613,296,616,296,619],{},[147,611,612],{},"connected_at",[147,614,615],{},"last_packet_at",[147,617,618],{},"last_ping_at",[147,620,621],{},"last_attempt_at",[288,623,624,627],{},[147,625,626],{},"Instant","s",[273,629,630,635],{},[288,631,632],{},[147,633,634],{},"reconnect_attempts",[288,636,637],{},"since the last successful connect",[273,639,640,648],{},[288,641,642,296,645],{},[147,643,644],{},"pending_acks",[147,646,647],{},"buffered_emits",[288,649,650],{},"waiting acks, queued offline emits",[273,652,653,667],{},[288,654,655,296,658,296,661,296,664],{},[147,656,657],{},"packets_in",[147,659,660],{},"packets_out",[147,662,663],{},"bytes_in",[147,665,666],{},"bytes_out",[288,668,669],{},"traffic counters",[273,671,672,677],{},[288,673,674],{},[147,675,676],{},"sessions",[288,678,679],{},"successful connects (the first one and every reconnect)",[135,681,683],{"id":682},"heartbeat-and-sleep","Heartbeat and sleep",[342,685,686,687,689,690,692],{},"The client fails the connection with ",[147,688,420],{}," when no ping arrives within pingInterval + pingTimeout. It also compares the wall clock with the deadline: when the wall clock says the deadline passed but the monotonic clock does not (the machine slept, or NTP stepped the clock forward), the client probes the link (a noop POST over polling, a websocket ping) and gives it pingTimeout to show life; only then is it a ",[147,691,420],{},". A backward clock step has no effect.",[135,694,696],{"id":695},"reconnect-after-close","Reconnect after close",[342,698,699,702,703,296,705,707,708,711,712,715,716,719],{},[147,700,701],{},"client.reconnect().await"," connects a closed client again (after ",[147,704,480],{},[147,706,495],{},", a server disconnect or ",[147,709,710],{},"disconnect()",") with the same handlers; ",[147,713,714],{},"auth_with"," \u002F ",[147,717,718],{},"connect_params_with"," run again first.",[140,721,723],{"className":142,"code":722,"language":144,"meta":145,"style":145},"if let ConnectionState::Closed { reason: DisconnectReason::ReconnectFailed, .. } = client.state() {\n    client.reconnect().await?;\n}\n",[147,724,725,782,801],{"__ignoreMap":145},[150,726,727,731,734,736,739,742,744,746,749,752,754,756,758,761,764,767,770,773,777,780],{"class":152,"line":153},[150,728,730],{"class":729},"s7zQu","if",[150,732,733],{"class":156}," let",[150,735,164],{"class":163},[150,737,738],{"class":167},"::",[150,740,741],{"class":163},"Closed",[150,743,177],{"class":167},[150,745,214],{"class":180},[150,747,748],{"class":167},":",[150,750,751],{"class":163}," DisconnectReason",[150,753,738],{"class":167},[150,755,495],{"class":163},[150,757,198],{"class":167},[150,759,760],{"class":167}," ..",[150,762,763],{"class":167}," }",[150,765,766],{"class":167}," =",[150,768,769],{"class":180}," client",[150,771,772],{"class":167},".",[150,774,776],{"class":775},"s2Zo4","state",[150,778,779],{"class":167},"()",[150,781,168],{"class":167},[150,783,784,787,789,792,795,798],{"class":152,"line":171},[150,785,786],{"class":180},"    client",[150,788,772],{"class":167},[150,790,791],{"class":775},"reconnect",[150,793,794],{"class":167},"().",[150,796,797],{"class":729},"await",[150,799,800],{"class":167},"?;\n",[150,802,803],{"class":152,"line":187},[150,804,265],{"class":167},[135,806,808],{"id":807},"shutdown","Shutdown",[342,810,811,814,815,817,818,820],{},[147,812,813],{},"client.disconnect().await"," leaves the namespace and closes the connection. It is bounded (on a dead link: 1 s to send what is queued and the goodbye, 1 s for the engine.io close) and no handler starts after it returns. Dropping the last ",[147,816,28],{}," closes the connection too (",[147,819,510],{},").",[822,823,824],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}",{"title":145,"searchDepth":171,"depth":187,"links":826},[827,828,829,830,831,832],{"id":137,"depth":171,"text":138},{"id":350,"depth":171,"text":351},{"id":538,"depth":171,"text":539},{"id":682,"depth":171,"text":683},{"id":695,"depth":171,"text":696},{"id":807,"depth":171,"text":808},"ConnectionState, DisconnectReason, LinkInfo, the heartbeat, reconnect() and shutdown.","md",null,{},true,{"title":42,"description":833},"Q2G7rL59vKJcebCSgF8jFZpxZfaJuR8TxGlhnHl0NFg",[841,843],{"title":38,"path":39,"stem":40,"description":842,"children":-1},"Handlers, emit, acks in both directions, payloads and binary data.",{"title":46,"path":47,"stem":48,"description":844,"children":-1},"Polling, websocket and upgrade; HTTP proxies from the builder or the environment; the shared HTTP client.",1795285663245]