When the websocket API is removed in Lemmy v0.18.0, how should applications that need constant updates about new posts, comments, etc., be designed? Should polling be used, or is there a better alternative? If not, how should it be done to minimize load on the servers? Thanks in advance!
You must log in or register to comment.
As far as I can tell here are your options:
- Polling. The easiest answer, and probably the only if you don’t own your instance. I would suggest running your own server or at least coordinating with the admins of your server to minimize the impact since many instances are overloaded as it is.
- Proxy shenanigans with your own instance. You could probably implement something that sits in front of lemmy (or something your reverse proxy sends a copy of requests to) that would get federation messages and API calls in real-time. If done as a proxy this could even act as a filter for incoming messages if you wanted.
- Database shenanigans with your own instance. Assuming you have access to the DB of your instance you could set up logical replication and use something like pypgoutput to handle messages from the database showing every change to every table.
- Wait. Maybe at some point something like webhooks or writing events to some sort of message queue/stream will be added, which would be great for moderation tooling. If instances wanted to they could then provide this information over a websocket for consumers who want/need a real-time feed (ala pushshift) without even having to run on the same hardware as the lemmy instance itself.
@crt0o Hm…why did they remove that?
Apparently it has quite a few disadvantages