Hi.
Before open a bug, could you please tell me if my setup is ok?
Daphne 1.0.3
channels 1.0.3
routing.py
channel_routing = [
route("websocket.connect", ws_connect, path=r"^/ws/chat/$"),
route("websocket.connect", ws_connect_updates, path=r"^/ws/updates/$"),
route("websocket.receive", ws_message_updates, path=r"^/ws/updates/$"),
route("websocket.disconnect", ws_disconnect),
route("http.request", http_ping, path=r"^/ping$", method=r"^GET$"),
]
channels worker started with:
manage.py runworker -v2
daphne started with:
daphne -e ssl:8003:privateKey=/etc/haproxy/keyring/spy.key:certKey=/etc/haproxy/keyring/spy.cert -v2 spywebsockets.asgi:channel_layer
No load balancer between client and sevrer (it's a dev env)
Client:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WebSocket Client</title>
</head>
<body>
<script src="jquery.js"></script>
<script src="reconnecting-websocket.js"></script>
<script>
$(function () {
var wsUrl = "wss://127.0.0.1:8003/ws/updates/";
console.log("Connecting to " + wsUrl);
var socket = new ReconnectingWebSocket(wsUrl);
});
</script>
</body>
</html>
Error in firefox console:
11:54:03.682 Connecting to wss://
127.0.0.1:8003/ws/updates/ websocket_client.html:14:9
11:54:05.686 Firefox can’t establish a connection to the server at wss://
127.0.0.1:8003/ws/updates/. reconnecting-websocket.js:213:17
11:54:05.687 The connection to wss://
127.0.0.1:8003/ws/updates/ was interrupted while the page was loading.
Logs in daphne console:
ssh://
ubu...@127.0.0.1:2222/opt/venv/spywebsockets/bin/python -u /opt/venv/spywebsockets/bin/daphne -e ssl:8003:privateKey=/etc/haproxy/keyring/spy.key:certKey=/etc/haproxy/keyring/spy.cert --proxy-headers -v2 spywebsockets.asgi:channel_layer
2017-02-23 11:42:02,875 INFO Starting server at ssl:8003:privateKey=/etc/haproxy/keyring/spy.key:certKey=/etc/haproxy/keyring/spy.cert, channel layer spywebsockets.asgi:channel_layer.
2017-02-23 11:42:02,877 INFO Using busy-loop synchronous mode on channel layer
2017-02-23 11:42:02,877 INFO Listening on endpoint ssl:8003:privateKey=/etc/haproxy/keyring/spy.key:certKey=/etc/haproxy/keyring/spy.cert
2017-02-23 11:42:02,883 INFO HTTPFactory (TLS) starting on 8003
2017-02-23 11:42:02,883 INFO Starting factory <daphne.http_protocol.HTTPFactory object at 0x7f0a34a72b38>
It seems that daphne never handles the connection. If I restart daphne on the same port, but without ssl and change from wss to ws, all is fine (so no firewall issue)
Thanks,
Giovanni