MayamaTakeshi / redmine_rt

Redmine plugin for Real-Time notification of events
GNU General Public License v3.0
24 stars 4 forks source link

Check if we are delaying opening the WebSocket connection #29

Closed MayamaTakeshi closed 1 year ago

MayamaTakeshi commented 1 year ago

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

AndreySolod commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

MayamaTakeshi commented 1 year ago

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.