hmr and WebSockets
hi, when trying to use websockets during development, it can take up to 20 seconds for the socket to connect after an hmr reload. Can I somehow not try to keep the websocket state during hmr and just reconnect?
3 Replies
The root component is not reloaded unless changed. If you instantiate the web socket there, it should be kept.
it's not in the root component. The issue is, that when I reload or change anything, it takes ages for the socket to connect. if I build then serve, it works instantly everytime.
I can
console.log(ws)
directly after creating it, but the onopen
event triggers extremly late or not at all
when using build + serve it works instantlyThat's because HMR unloads and reloads every component in files that changed.
The unloading could be taking some extra time.