3

Before people were using python websockets with django for websocket handling. Now the django-channels came as an official django project which supports django to handle websockets. can anyone list the advantage of django channels over python websockets in terms of django web development?

One point would be,

  • Since channels built for django web development, it would be well integrated with django framework.

Thanks for any reply.

3
  • django channels and websockets are 2 different things which you can't compare. Commented Nov 21, 2016 at 10:17
  • 1
    Both handles websocket right? Could you please explain your comment? Commented Nov 21, 2016 at 10:21
  • Ok, I might be wrong here, as it seems to include more than I expected. Commented Nov 21, 2016 at 10:25

1 Answer 1

5

Django channels is not just a library for WebSockets:

Channels is a project to make Django able to handle more than just plain HTTP requests, including WebSockets and HTTP2, as well as the ability to run code after a response has been sent for things like thumbnailing or background calculation. (docs).

In your particular case (WebSockets), Channels makes it easier to work with them, as it extends Django providing all the required components (the Daphne server, asgi_redis, etc). It also provides an interface to them that resembles that of views, making it easier for Django developers.

It also adds some other useful functionality, such as data binding, routing or groups, which are things you are likely to use, saving you the burden of implementing them yourself.

In short: it makes WebSocket handling much easier :)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.