Skip to content
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

Users report ERR_CONNECTION_RESET #31

Open
dmonn opened this issue Jan 10, 2019 · 7 comments
Open

Users report ERR_CONNECTION_RESET #31

dmonn opened this issue Jan 10, 2019 · 7 comments

Comments

@dmonn
Copy link

dmonn commented Jan 10, 2019

  • django-private-chat version: 0.1.6
  • Django version: 1.11.1
  • Python version: 3.6
  • Operating System: Ubuntu 16.04 Server

Description

I have django-private-chat deployed in production.
Users sent me feedback that they get the following error sometimes (it seems to happen in corporate networks only)

WebSocket connection to XY failed: Error in connection establishment: net::ERR_CONNECTION_RESET.

The chat works fine in 90% of the cases, but this error seems to come up from time to time. Chat is embedded in an iframe (same domain), this could add to the problem.

What I Did

Made sure the chat server is running, tested the chat in my home network - seems to work fine.

Users report:

WebSocket connection to XY failed: Error in connection establishment: net::ERR_CONNECTION_RESET.

@delneg
Copy link
Collaborator

delneg commented Jan 10, 2019

Can you probably try using a newer version of websockets lib ?
Seems to be similar to this issue: django/channels#549

@dmonn
Copy link
Author

dmonn commented Jan 10, 2019

Let's try!

@dmonn
Copy link
Author

dmonn commented Mar 5, 2019

Note @delneg, the upgrade worked, but the issue still seems to persist. I'm not sure about how to locally reproduce this though. It seems to happen in restrictive corporate environments.

@delneg
Copy link
Collaborator

delneg commented Mar 5, 2019

Hello again, what do you mean by 'upgrade worked' ?
Please provide more details.
Also, you could try to implement re-connection by handling 'connection reset' events in javascript and estabilishing a new websocket connection.

@dmonn
Copy link
Author

dmonn commented Mar 6, 2019

The upgrade of websockets didn't make any problems.
I'm already doing reconnects with https://github.com/joewalnes/reconnecting-websocket.

Again, this only seems to occur in corporate networks.

@alisarmad
Copy link

Hi everyone,
I am also facing WebSocket connection problem since last couple of days.
Error Description
"websocket.js:18 WebSocket connection to 'ws://127.0.0.1:8000/ws' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED"

Browser Console Error line Number 18, (connect @ websocket.js:18) contains following code
const path = 'ws://127.0.0.1:8000/ws'; this.socketRef = new WebSocket(path); this.socketRef.onopen = () => { console.log('WebSocket open'); };
socketRef.onclose @ websocket.js:33
``
websocket.js:29 undefined
websocket.js:32 WebSocket closed let's reopen
32Chat.js:27 wait for connection...

Detail
Django version : 2.2
Front-end with react
Using Parceljs

Websocket was working fine with Bootstrap and Django Channels, I am trying to develop one to one chat application with React front-end and Python Backend, When I tried to implement the WebSocket in react then it is giving me above mentioned error.

What I have tried
Django Channels Issue(549)

I am new to Websocket and React,
Any help will be appreciated.

@alisarmad
Copy link

I have solved the above error, actually there was my mistake, I forgot to run both servers(Backend: [python manage.py runserver], and frontend react [npm start]).

Therefore, make sure we have both servers running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants