Comments (6)
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?
from daphne.
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.
Without sending the message I get records in the log about that the client has been connected but immediately there are disconnection of the websocket client and I have messages in my browser:
WebSocket connection to 'wss://my.domain.net:8443/4/stream/' failed: WebSocket is closed before the connection is established.
and after a few attempt:
reconnecting-websocket.min.js:1 WebSocket connection to 'wss://my.domain.net:8443/4/stream/' failed: Error in connection establishment: net::ERR_TIMED_OUT
from daphne.
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
from daphne.
Thanks for your hint! I'll try it soon.
from daphne.
Closing due to lack of response.
from daphne.
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.
from daphne.
Related Issues (20)
- Missing support for --nostatic and --insecure options in Daphne's runserver command HOT 2
- how to set websocket send buffersize in daphne
- issuse when i using daphe in my django app with streaminghttpresponse HOT 7
- Can daphne run WSGI apps? HOT 6
- Does daphne have a file for initialization?
- Requests with Transfer-Encoding: chunked have no content HOT 14
- StreamHttpResponse with sync operations break in Daphne HOT 5
- Memory usage: Daphne loading all the file in memory (POST request) HOT 7
- Text streaming buffered issue
- Implement WebSocket Denial Response extension HOT 8
- [feature request] trailing headers HOT 1
- Add support for Python 3.12
- DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13 HOT 1
- Daphne with self signed ssl HOT 2
- Daphne allows invalid characters within header names HOT 5
- Unix File Socket Argument HOT 12
- TypeError: object HttpResponse can't be used in 'await' expression HOT 3
- add support for --proxy-headers and friends in runserver HOT 4
- fd_endpoint.py is not properly installed HOT 7
- python manage.py runserver not working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from daphne.