I am building a cafeteria management system in which there are two types of users;customres & counter owners.
For each dish offered in cafeteria, there is aunique dish.id associated to it.
Till now, I have dome something like student sends a POST request with dish,id and counter number to a URL which updates the “orders table'(which has PK as id). When the dish is prepared, the counter owner presses “Prepeared” button.
At this point, I want the customer whose order is next to what is prepared to get notified that “Your order preparation is in progress.”
How should I do it?
One way is to simply make a view which has its argument as customer.id & status and it replies with True or Flase. I can simply poll the URL and provide the notification if I recieve True.
But, I feel like polling is not a better approach as there will be so many customers logged in and each will poll to the server which is not acceptible.
Any better way?
It really depends what you really need.
If notification can be sent ad part of user activity, simply add a user message, and it will be displayed whenever user do an action on the page. django.contrib.messages plus few lines in your main html template will do it.
But if you want the notification to be interactive – you can use one of the few PUSH options
Interesting links:
From the servers side, there are few options available, the simplest is Green Unicorn. Using it will allow you to have few thousands connections open and managed by only few processes.