Demonstrates an issue with Vite that prevents SSE from closing connections when the browser window is closed or refreshed.
This issue occurs in dev mode but not in prod mode.
Demonstrates SSE not closing connections when the browser window is closed or refreshed. You will see in the Chrome DevTools console that client connections are accumulating when you refresh the page which shouldn't happen.
- start the app using
npm run dev - visit, http://localhost:3000
- open the browser console
- refresh the page a few times and see the number of connections grow ("There are 1 person(s) here right now!" then "There are 2 person(s) here right now!"...)
Demonstrates SSE disconnect working as expected
- build the app using
npm run build - start the app using
npm start - visit, http://localhost:3001 (make sure you change https to http if your browser changes it automatically)
- open the browser console
- refresh the page a few times and see the number of connections remain at 1 ("There are 1 person(s) here right now!")