Don't try to reconnect the socket when we closed it intentionally#3402
Conversation
64d10a3 to
f39920d
Compare
|
/backport to stable18 |
danxuliu
left a comment
There was a problem hiding this comment.
I have added some fixes on top of the current strategy.
However, I have realized that the whole beforeunload handling could be removed if we just check the code attribute in the close event. In theory when the code is 1001 the user is navigating away, so if we do not try to reconnect in that case it should be enough.
Right now, if the user tries to navigate away, stays in the call and the external signaling server goes away in that moment then it will not get reconnected. Sure, a very corner case, but possible nevertheless. This would be prevented by checking the code instead of using the current approach (although there could be other drawbacks I am not seeing, I do not know).
|
Maybe I mixed soemthing up, but the real problem I had which is why I did this was when the connection is terminated because we switch the HPB because of the clustering. But maybe the code works there as well |
97d5336 to
ea53684
Compare
|
Yes, but the commit is covering two different cases: prevent reconnecting when the signaling is disconnected, and prevent reconnecting when the page is about to be unloaded. As far as I understand it, prevent reconnecting when the signaling is disconnected is what is needed for the HPB clustering. That is OK, and it is not related to my comment. I only refered to prevent reconnecting when the page is about to be unloaded, as I think that could be handled easier just by checking the code from the close event, with no needs for |
|
Feel free to add/change it |
ea53684 to
49b06ba
Compare
|
Updated and much less intrusive now! |
49b06ba to
0235c9b
Compare
|
The commit |
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
…n top of error Signed-off-by: Joas Schilling <coding@schilljs.com>
0235c9b to
4981c33
Compare
|
Rebased and dropped it |
Extracted from #3292