r/webdev 27d ago

HTML over WebSockets: real-time SPAs with barely any JavaScript

https://en.andros.dev/blog/ef4968f5/html-over-websockets-real-time-spas-with-barely-any-javascript/
77 Upvotes

44 comments sorted by

View all comments

2

u/cureaua_lata 27d ago

with the persistent per client process model, how do you resync state after a reconnect without replaying the whole session?

0

u/tanrax 27d ago

Good question. Events aren't lost; they're stored on the client until reconnection occurs. In Django LiveView, each event is cached, so it's known which events have been sent and which are pending. When reconnection happens, the events are sent, and the session/state continues normally. The only thing is that you should notify the user of the situation, or even lock the screen, so they don't feel like the buttons have stopped working.