1👍
Approach 1 which you specify is called polling and which will generate multiple calls to server so it is not recommended.
Approach 2 is not feasible since you will have time out.
Right way(efficiently) to do this type of thing is via WebSockets or some kind of Push Notification from server. few libraries are
http://socket.io/
https://github.com/SignalR/SignalR/wiki/Faq
If this had helped you don’t forgot to mark it as answer 🙂
0👍
Polling is simplest option since it will work with plain Django system.
There exists several other techniques to keep connection open and send messages to client (browser), like websockets or server sent events (sse), but those require additional components in infrastructure than just Django.
And you can’t keep server waiting, browsers and frontend webservers usually do have time limits to detect dead connections so your connection would be terminated before game starts.
- [Answer]-Django form submit not working
- [Answer]-AJAX not working with Django App
- [Answer]-OneToOneField Relationship Not Created
- [Answer]-Installing django-dash – Download error, could not find suitable distribution for [multiple packages]
0👍
Your server knows when the game will start, like 5pm? Tell the browser’s JavaScript to start polling at 4:59:40
- [Answer]-Check multiple objects up against request.user in template django
- [Answer]-How to combine two similar view into one
- [Answer]-Django can't show images on page
- [Answer]-Email.send() taking forever for manual connection
- [Answer]-What's best practice for logging a django app on AWS?