4 ms·
What are "Watcher Views"?
by twic 7y ago
What are "Watcher Views"?
- cerberusss 7y agoI think they mean the following. In Django, a view function, or view for short, is a Python function that takes a Web request and returns a Web response. So a watcher view is probably a view that returns an extremely short response. It's just telling you whether more data is available, or not. They mention websockets as an alternative that's far more complex.
- belzebalex 7y agoYup exactly you've understand it all.
- MaysonL 7y agoFrom the article: "These are views that tell you when a model changed last. Watcher Views are light enough so that you can continuously call them to know whether you should fetch recent data. They're far less complex than WebSockets and avoid the performance costs of continuously polling unchanged data from the API."
- catchmeifyoucan 7y agoDo you still have to poll a Watcher View - if it's an endpoint that tells you if the model is updated or not?
- belzebalex 7y agoYes you do, except that it's much faster for the backend to answer as it just hits a cache instead of doing a db query and serializing the whole model.