Hello,
I'm using django-channels for some months and I'm observing a behaviour for which I don't know if it's a normal one, or a misconfiguration from my side.
Here is my pretty simple consumer :
# Connected to websocket.connect
@channel_session_user_from_http
def ws_task_connect(message):
if isinstance(message.user, AnonymousUser):
message.reply_channel.send({"close": True})
else:
# Accept connection
message.reply_channel.send({"accept": True})
# Add them to the right group
Group("task-%d" % message.user.pk).add(message.reply_channel)
refresh_current_tasks(message.user, send_if_empty=False)
# Connected to websocket.disconnect
@enforce_ordering
@channel_session_user
def ws_task_disconnect(message):
Group("task-%d" % message.user.pk).discard(message.reply_channel)
It does work but if my user does refresh the page, I see a new entry in the session table (django_session). In other terms, if my user browse 20 different pages in his administration panel, I'll have 21 entries in the django_session table (1 session created by the native Django SessionMiddleware, 20 for every WebSocket created by browsing the 20 pages). Is it normal or shouldn't this by reduced to 2 entries?
For information, upgrading to django-channels 2 is not yet an option for this project.
Kind regards,