-
Notifications
You must be signed in to change notification settings - Fork 3k
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
WebSocketSubject does not reconnect with beta10 (change behaviour from beta7) #1863
Comments
Thanks for reporting this. We'll have a look |
I have run into this as well, and I think this is due to My guess would be that inside this branch when the socket is closed: https://github.com/ReactiveX/rxjs/blob/master/src/observable/dom/WebSocketSubject.ts#L213 It should also do something like |
And probably also here: https://github.com/ReactiveX/rxjs/blob/master/src/observable/dom/WebSocketSubject.ts#L213 Basically, any time the socket is set to null, it should reset |
I tried it today with beta11 and now an error pops up again! :)
Maybe this helps to find the problem? (Even though this is from the I hacked together a little project to debug the issue: https://github.com/sebald/WS-Reconnect |
So, I tried out your reconnect thing with the |
Could you post your I noticed that when |
I don't have a patch atm, but basically everywhere it has On Thu, Sep 1, 2016, 23:18 Sebastian Sebald notifications@github.com
|
I found a solution, but I am not convinced that it is the correct one, because I am not 100% familiar with the internal of RxJS 😢 Anyway ... I added the following line to the if (socket && socket.readyState === 3) {
this.socket = null;
this._output = new Subject<T>();
} This will clear the current Here is the commit in my fork: sebald@85f4f87 I updated the repo I mentioned before accordingly: https://github.com/sebald/WS-Reconnect |
So looking into this, @sebald was on the right track... but it's a little broader than that. There are three things that need to happen everytime we want to "reset" and null out the
That seems to fix all reconnection issues, even with multiplexed sockets. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RxJS version: 5.0.0-beta10
Code to reproduce:
Expected behavior:
When the connected WS server is shut down, constantly push
errors
to theretryWhen
until no errors are thrown anymore (=> server is back online again).Actual behavior:
retryWhen
is called and the timer observable is constantly repeated, but theWebSocketSubject
seems not to recognise that the server is back online.Additional information:
I wanted to update the dependencies of our app we wrote a few months back. We used beta7 before. Updating rxjs to beta8-10 will "break" the reconnecting feature we implemented with the above code .
It seems that with the rewrite of
Subject
in beta8 the behaviour completely changed. Bevor the console did show the following:With beta10 the same code will behave like this:
The beta10 is (from my point a view) a lot nicer because it doesn't trigger the
closeObserver
multiple times and there is no error anymore :) But it also does not recognise when the WebSocket connection is availble again.I tried to debug it myself but couldn't find a the issue.
EDIT: I added the fix applied in 848a527 but didn't solve my problem.
The text was updated successfully, but these errors were encountered: