-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Websocket connection by HTTPS with Let’s Encrypt #66
Comments
It looks fine to me at first glance - and if Firefox connects it means websocket is getting through alright. What error do you get from the other browsers? |
I forgot to say that a successful connection I get by means of little hack in my routing.py: def ws_connect(message, pk):
logger.info("WS: connected new user with pk={}".format(pk))
try:
user = User.objects.get(pk=pk)
if not user.is_authenticated():
logger.warn("WS: user pk={} is not authenticated".format(pk))
return # using /stream/ (devices) only for authenticated users
Group(user.group_name).add(message.reply_channel)
# FIXME: little hack, send a message for connection establishment
group = Group(user.group_name)
group.send({
"text": json.dumps({
'payload': {
'action': 'connection',
'data': {}
}
}
),
})
except ObjectDoesNotExist:
logger.warn("WS: user for pk={} not found".format(pk))
except Exception as ex:
logger.error(ex) Without sending of the empty message the connection does not established and in Firefox too.
and after a few attempt:
|
Ah, it's because you're not accepting the connection like 1.0 now requires! See http://channels.readthedocs.io/en/latest/releases/1.0.0.html#connect-consumers |
Thanks for your hint! I'll try it soon. |
Closing due to lack of response. |
Hi I am experiencing a very similar issue to zeezdev. My setup is almost identical, besides me using Apache instead of nginx. I keep getting "WebSocket is closed before the connection is established." warnings followed by a "WebSocket opening handshake timed out" error after the web socket not being able to connect. Is there a suggested fix for this? I am running daphne with letsencrypt certificates in much the same was as described by zeezdev. |
My configuration of Websocket work in Firefox but in Opera/Chrome not working,
I have a few question about the using daphne:
Please help me understand the correct configuration daphne with HTTPS!!!
All work fine except Websocket connection (
I run daphne as:
Django(Channels) -> daphne -> nginx
run django worker:
run daphne with LetsEncrypt certificates:
When I run my site without HTTPS (HTTP only) and run daphne as:
Websocket is connected in all browsers.
nginx configuration:
Websocket connection on client (browser) with using ReconnectingWebSocket:
The text was updated successfully, but these errors were encountered: