I use Django and Gunicorn to work with front-end iOS applications. So far, I have used simple GET, PUT, POST requests to send and receive json data from my iOS application on my Django server and vice versa.
However, this setup was solid, I would like to use real-time messaging. When I first started working, I used APNS (Apple Push Notifications Service) to deliver messages in real time to recipients. Here is an example of what I used:
If UserA messaged UserB, I would send a message to the Django server via JSON, process it in the Django view, use the pyAPNS python shell for APNS, and it will send a push notification to the UserB user (recipient) along with the payload size of 256 bytes. This worked well, but it also has a few drawbacks.
If the recipient wants to disable push notifications, they will not receive the message. When you implement basic data in your iOS application, it can be quite confusing if you cache objects.
So that leaves me with another option. Building something based on sockets that can work with Django and send the payload as JSON. Any ideas?
source share