Chat application for Django using websockets
pip install django-rechat
Add "rechat" and "instant" to INSTALLED_APPS in settings and update urls.py:
urlpatterns = [
# ...
path("instant/", include("instant.urls")),
path("rechat/", include("rechat.urls")),
]Install the websockets server: quickstart
Create chat rooms in the admin
An Alpinejs frontend is available. To use the rechat templates create your own index template (here with Tailwind css classes):
{% extends "base.html" %}
{% block content %}
{% include "rechat/init.html" %}
<div class="flex flex-row h-full" x-init="$rechat.hxget('{% url 'rechat-rooms' %}', '#rooms')">
<div id="rooms" class="w-2/12 h-full p-3 border-r border-gray-200 bg-slate-100">
Loading rooms ..
</div>
<div id="room">
<div class="p-5 text-stone-400">Select a chatroom</div>
</div>
</div>
{% endblock %}A runnable example project is available
- Add a persistence layer option
- Group level authorizations and rooms
- Rate limits
- Channel admin, kick/ban
- Add a presence widget to show users in the chat