Websocket Hibernation DO + Vite local dev
Hi all, im facing an issue and it’s making me pull my hair out
I’m currently writing a Vite app (React Router 7) , using cloudflare’s official vite adapter.
I’m enabling users to see who is connected to a given page (much like the tutorial on the cf docs itself)
But whenever i refresh, or leave the page, connections seem to linger and never close, so each refresh almost always leaves me with one more user than there was connected. Each refresh adds to the number of connections but does not remove the old ones.
Lots of tries to fix it in every possible way, but it did not work. There are lots of
mdworker_shared
processes created alongside the workerd
instance when i check Activity Monitor, not sure that is relevant but there are like 20 of those all using 0 CPU1 Reply
finding: it has something to do with disconnecting before a connection has been established, it does not clear it nor call
websocketClose
i fixed it by making the client less spammy, but this is definitely an inherent issue of websockets hibernation server running locally