{"record":{"id":"09305f4abb008322","repo":"gatsbyjs/gatsby","slug":"socket-io-disconnected-from-dev-server","errorCode":null,"errorMessage":"[socket.io] Disconnected from dev server.","messagePattern":"\\[socket\\.io\\] Disconnected from dev server\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/gatsby/cache-dir/socketIo.js","lineNumber":34,"sourceCode":"        socket.on(`reconnect_attempt`, () => {\n          socket.io.opts.transports = [`polling`, `websocket`]\n        })\n\n        socket.on(`message`, msg => {\n          if (msg.type === `overlayError`) {\n            if (msg.payload.message) {\n              reportError(msg.payload.id, msg.payload.message)\n            } else {\n              clearError(msg.payload.id)\n            }\n            ___emitter.emit(msg.type, msg.payload)\n          }\n        })\n\n        // Prevents certain browsers spamming XHR 'ERR_CONNECTION_REFUSED'\n        // errors within the console, such as when exiting the develop process.\n        socket.on(`disconnect`, () => {\n          console.warn(`[socket.io] Disconnected from dev server.`)\n        })\n      } catch (err) {\n        console.error(`Could not connect to socket.io on dev server.`)\n      }\n    }\n    return socket\n  } else {\n    return null\n  }\n}\n\n// Tell websocket-manager.js the new path we're on.\n// This will help the backend prioritize queries for this\n// path.\nfunction registerPath(path) {\n  socket.emit(`registerPath`, path)\n}\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/gatsby/cache-dir/socketIo.js#L16-L52","documentation":"Development-runtime notice from Gatsby's socket.io client wrapper: the socket emitted a disconnect event (dev server stopped, restarted, or network drop). Shown to explain why hot updates stopped; the socket.io client auto-reconnects, and the message throttles XHR ERR_CONNECTION_REFUSED spam in the console.","triggerScenarios":"Thrown at packages/gatsby/cache-dir/socketIo.js:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Expected when `gatsby develop` exits or restarts — reload the page once the server is back","If it persists while the server runs, check the websocket isn't blocked (proxy, firewall, HMR customizations)","Restart the dev server if the client fails to reconnect automatically"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}