Search code examples
djangovue.jsdjango-rest-frameworkdjango-channels

Using Django REST framework for real-time chat?


I'm trying create a real-time chat app with Django and Vuejs. I would like to use django-rest-framework for this but I don't know how to make it real-time. I have used django-channels before but I'm curious if I can use only django-rest-framework as an alternative or maybe integrated it with django-channels.


Solution

  • You don't have to integrate them, because django channels are sending and accepting json data to websocket, as your rest framework api does. Rest framework is made for api, django channels for websockets, they won't have nothing in common cuz they have different implementations. The only thing you could consider integrating is rest framework auth inside django channels see: How do you authenticate a websocket with token authentication on django channels?