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

Check if we are delaying opening the WebSocket connection #29

Closed
MayamaTakeshi opened this issue Apr 21, 2023 · 6 comments
Closed

Check if we are delaying opening the WebSocket connection #29

MayamaTakeshi opened this issue Apr 21, 2023 · 6 comments

Comments

@MayamaTakeshi
Copy link
Owner

If yes, remove this delay as we only need it in case of reconnection.

@AndreySolod
Copy link

I am test the problem #20 - magically everything worked, I don't know how yet (I tested it on the same computer on which it didn't work). Adding the npm package did not solve the problem. Maybe something has to do with the page cache? I didn't set up location/cable the first time, then I'll test it on a virtual machine.

@MayamaTakeshi
Copy link
Owner Author

MayamaTakeshi commented Apr 29, 2023

I tested and could reproduce this.
It is not an intentional delay. It happens that due to some unknown reason the websocket connection fails to be established.
The browser keeps trying and eventually it succeeds but this causes the delay we are seeing.

Webconsole shows this:

Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29
Firefox can’t establish a connection to the server at ws://192.168.225.201:3000/cable. action_cable.js:239:29

Then at some point this stops happening indicating the websocket connection was successful.

@MayamaTakeshi
Copy link
Owner Author

However, today I tried to reproduce this several times with both firefox and chrome and it never happened.
I did some changes in the code to solve other issues not related to WebSocket/ActionCable but maybe they had some effect in this issue somehow. Please get the latest code and see if you still can reproduce this.

@AndreySolod
Copy link

Ok, I am testing solution, details the sequence of actions in #32, launched via the command:
bundle exec rails server -e production -b 0.0.0.0
And got the following problem: notes are created, attached, but not dynamically. Log in console:
image
In production.log all ok.
REST-service is enabled, JSON support too.
Also, Redmine thinks that someone else has updated the task:
image
Ok, let's open new tab and try again...
oh, looks like there are an error in console:
image
The error is reproduced every time - from the tasks page we go -> Projects -> our project -> issues -> 1. Leaves after page reload. Browser - yandex (chrome like).
Mozilla Firefox is still sadder, and the error, apparently, is not related to some kind of cache, as I initially thought - it is reproduced both on Firefox and in private mode on yandex. Probably, you need to wait a day again until everything is magically repaired:(

@AndreySolod
Copy link

...Hey, It's really a cache!
I am clean all browser history with cache, cookie, etc and everything working!

@MayamaTakeshi
Copy link
Owner Author

MayamaTakeshi commented May 1, 2023

OK. So your problem was different than mine.
But the Rails asset pipeline should have avoided caching by doing asset fingerprinting (add a number to the end of them to invalidate cache).
Anyway for now I will close this issue. Thanks.

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

2 participants