-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Describe the bug/A short description of the bug.
Django project with chatroom, employs django-valkey, valkey, & channels[daphne]
When the chatroom has been open for exactly 5 seconds, the web-socket disconnects spontaneously ( no input required)
DevTools console: 6/:88 Chat socket closed unexpectedly
Code snippet from python3.13/sitepackages/valkey/asyncio/connection.py lines 554-559:
"""Read the response from a previously sent command"""
read_timeout = timeout if timeout is not None else self.socket_timeout
host_error = self._host_error()
PROBLEM RESOLVES if these two lines are added by me at this point :
read_timeout = None
self.protocol = 3
lines 561 - 566 ( for additional context)
try:
if (
read_timeout is not None
and self.protocol in ["3", 3]
and not LIBVALKEY_AVAILABLE
):
In its uncorrected state, the value of self.protocol is 2,
the value of read_timeout is 5 (seconds),
explaining the automatic timeout.
LIBVALKEY_AVAILABLE is always = object()
Other possibly pertinent code snippets from settings.py:
INSTALLED_APPS = [
# Daphne must be at the start of the list
'daphne',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# 3rd party apps
'embed_video',
'debug_toolbar',
'django_valkey',
'rest_framework',
# local apps
'courses.apps.CoursesConfig',
'chat.apps.ChatConfig',
'students.apps.StudentsConfig',
]
CACHES = {
'default': {
'BACKEND': 'django_valkey.cache.ValkeyCache',
'LOCATION': 'valkey://127.0.0.1:6379',
'OPTIONS': {
'CLIENT_CLASS': 'django_valkey.client.DefaultClient',
# Optional extras:
# 'PASSWORD': 'your-valkey-password',
# 'SERIALIZER': 'django_valkey.serializers.pickle.PickleSerializer',
},
}
}
Metadata
Metadata
Assignees
Labels
No labels