Hello, and sorry for lots of questions about channels.
I can connect to the websocket from JavaScript and send/receive normally for exactly 60~61sec after that the HTTP request is repeated on it's own and the websocket disconnects.
Sometimes the HTTP get request is repeated more than once before the websocket disconnection.
Even just connecting and waiting for 60~61secs result in the same thing.
Terminal log
Django version 2.0.2, using settings 'husite.settings'
Starting ASGI/Channels development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
2018-02-05 01:35:22,350 - INFO - server - HTTP/2 support not enabled (install the http2 and tls Twisted extras)
2018-02-05 01:35:22,351 - INFO - server - Listening on endpoint tcp:port=8000:interface=127.0.0.1
[2018/02/05 01:35:27] HTTP GET /sessions/24/ 200 [0.05, 127.0.0.1:9066]
[2018/02/05 01:35:27] WebSocket HANDSHAKING /sessions/24 [127.0.0.1:9067]
[2018/02/05 01:35:27] WebSocket CONNECT /sessions/24 [127.0.0.1:9067]
[2018/02/05 01:36:28] HTTP GET /sessions/24 503 [61.05, 127.0.0.1:9067]
[2018/02/05 01:36:28] WebSocket DISCONNECT /sessions/24 [127.0.0.1:9067]
# settings.py
# ...
ASGI_APPLICATION = "husite.routing.application"
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("localhost", 6379)],
},
},
}
class MyConsumer(WebsocketConsumer):
def connect(self):
self.accept()
// Javascript code
ws = new WebSocket(`${protocol}://${location.host}/sessions/{{session.id}}`)