Realtime django - Channels to rescue
Implementing websockets in django was hard before Django channels
At its core, Django is built around the simple concept of requests and responses: the browser makes a request, Django calls a view, which returns a response that’s sent back to the browser. The view is only around for lifetime of request and there’s no mechanism to hold open a connection or send data down to the client without an associated request.
Earlier there was no standard implementation of websockets built right into django. We were supposed to use external libraries like dragon swarm, pusher etc. There was lot of work involved at developer side just to understand the nitty gritty details of the libraries.
So this is where django-channels came to rescue.
The whole idea of this talk is to know how to build scalable realtime application using websockets in django. For that, We will discuss how django-channels are going to help us in achieveing it.
The talk is going to cover two different “eras” of building realtime applications in django
1. Pre “channels” era
2. Post “channels” era
- How current request response cycle works in django(without django-channels)
- Why implementing websockets currently is hard
- How easy is to use django-channels to build scalable realtime applications
- A short demo
I am the cofounder of MindIQ. At MindIQ, we use django-channels to push realtime data to our clients used by 1000+ businesses globally.