DangerOnTheRanger / maniwani

Imageboard software for the 21st century
MIT License
76 stars 12 forks source link

Migrate live updating client code to use shared web workers when available #100

Open DangerOnTheRanger opened 5 years ago

DangerOnTheRanger commented 5 years ago

The current client-side JS (lamentably still embedded in templates/thread.html) that handles reading server-sent events and updating threads currently opens a new connection to the SSE endpoint for every new thread/tab opened by the client. This is wasteful and places an undue strain on the application server - a better approach would be to use shared web workers on supported browsers to only open one total connection per client. The server-side code in blueprints/live.py already has support for this kind of thing (the client-id passed with every request), so only the client-side code would need to be amended.

The non-shared worker implementation should still be kept around and maintained, though - Safari among others still lacks support for shared workers.

DangerOnTheRanger commented 4 years ago

This is currently being handled as a part of the react-ui branch; though at the time I write this, there isn't any fall-back implementation for Safari and friends. According to caniuse, Safari is the only browser that doesn't support the standard apart from IE (and who browses an imageboard with IE), though I want to close this issue if and only if a fallback implementation is provided.