Hrm, I don't know what's happening then, something in your browser is
stopping the connection before it even gets to Daphne. You'd have to break
out Wireshark or something and look at what the packets on the wire were
(and that's tough with TLS).

Anyone else have an idea what's happening?

Andrew

On Fri, Feb 24, 2017 at 12:06 AM, Giovanni Colapinto <
giovanni.colapi...@gmail.com> wrote:

> Yep, it works
>
> ssh://ubuntu@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-24 09:05:00,246 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-24 09:05:00,247 INFO     Using busy-loop synchronous mode on
> channel layer
> 2017-02-24 09:05:00,248 INFO     Listening on endpoint
> ssl:8003:privateKey=/etc/haproxy/keyring/spy.key:
> certKey=/etc/haproxy/keyring/spy.cert
> 2017-02-24 09:05:00,255 INFO     HTTPFactory (TLS) starting on 8003
> 2017-02-24 09:05:00,255 INFO     Starting factory 
> <daphne.http_protocol.HTTPFactory
> object at 0x7f31700d7b38>
> 2017-02-24 09:05:25,569 DEBUG    HTTP b'GET' request for
> http.response!QuVbbdTGYkgg
> 2017-02-24 09:05:25,747 DEBUG    HTTP 400 response started for
> http.response!QuVbbdTGYkgg
> 2017-02-24 09:05:25,748 DEBUG    HTTP close for http.response!QuVbbdTGYkgg
> 2017-02-24 09:05:25,752 INFO     "10.0.2.2" - - [24/Feb/2017:08:05:25
> +0000] "GET / HTTP/1.1" 400 57606 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64;
> rv:53.0) Gecko/20100101 Firefox/53.0"
> 2017-02-24 09:05:25,753 DEBUG    HTTP response complete for
> http.response!QuVbbdTGYkgg
> 10.0.2.2:1048 - - [24/Feb/2017:09:05:25] "GET /" 400 57606
> 2017-02-24 09:05:26,051 DEBUG    HTTP b'GET' request for
> http.response!GAGdgGoUEFHo
> 2017-02-24 09:05:26,141 DEBUG    HTTP 400 response started for
> http.response!GAGdgGoUEFHo
> 2017-02-24 09:05:26,143 DEBUG    HTTP close for http.response!GAGdgGoUEFHo
> 2017-02-24 09:05:26,143 INFO     "10.0.2.2" - - [24/Feb/2017:08:05:25
> +0000] "GET /favicon.ico HTTP/1.1" 400 57588 "-" "Mozilla/5.0 (Windows NT
> 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0"
> 2017-02-24 09:05:26,144 DEBUG    HTTP response complete for
> http.response!GAGdgGoUEFHo
> 10.0.2.2:1048 - - [24/Feb/2017:09:05:26] "GET /favicon.ico" 400 57588
>
>
>
> On Thursday, 23 February 2017 19:15:44 UTC+1, Andrew Godwin wrote:
>>
>> It looks correct - can you connect using https://127.0.0.1:8003/ at that
>> point either? It's really odd that apparently the connection doesn't even
>> happen at all.
>>
>> Andrew
>>
>> On Thu, Feb 23, 2017 at 2:55 AM, Giovanni Colapinto <
>> giovanni....@gmail.com> wrote:
>>
>>> 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://ubuntu@127.0.0.1:2222/opt/venv/spywebsockets/bin/python -u
>>> /opt/venv/spywebsockets/bin/daphne -e ssl:8003:privateKey=/etc/hapro
>>> xy/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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/f45f593d-b8db-4cc4-af10-4fbf1dc3e953%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/f45f593d-b8db-4cc4-af10-4fbf1dc3e953%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/a578a8cd-6dcb-4c6b-9309-911245ca1a01%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/a578a8cd-6dcb-4c6b-9309-911245ca1a01%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1uqQkjxYKDxDGg2kbDE8PWSKFgnc4WvvhO%3D0s53NK10KYw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to