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
Make the connection more reliable on bad condition networks #96
Make the connection more reliable on bad condition networks #96
Conversation
…etwork Make the connection more reliable on bad condition networks
I don't think adding magic tuning parameters here is a good idea. We either make it reliable or we don't. Asking the user to select a random timeout to maybe fix things is not really sustainable |
I didn't change the timeout, I made it possible to change it. It was The reliability is given from capturing the error I managed to reproduce To reproduce the errors commented in the code related to error code 1006 I Sorry if my pr/commit was not too clear, I spent too many hours in a row
|
@nzjrs Yeah, I think you are right. But I don't figure out the best way. |
With these last changes I found that the comunication is stable and in case of fault it reconnects without problems. |
Depends on the usecase, make it a parameter and let the user choose. The default behaviour is up to you to decide. As the library is more I don't know if we can get into any synchronization problems in between 2015-12-04 10:36 GMT+01:00 Davide notifications@github.com:
|
Ok. The risk of buffering is that, after losing the connection, the user interacts with the GUI (without knowing the actual server state), and at reconnection there is inconsistence of messages sent from the GUI to the server. I think that in all cases, all pendings have to be dropped. Just to explain with an example. @awesomebytes You are working with a joystick driving a robot. If you lose the connection during interaction, at reconnection the robot will be moved without control. Is it true? |
In my example, indeed, I get all pending messages in a row. Altho I have a 2015-12-04 11:15 GMT+01:00 Davide notifications@github.com:
|
I'm not suggesting the fix is not an improvement, it is just non sustainable to ask the user to select an arbitrary parameter which changes REMI's behaviour from 'works most of the time', to 'works a little bit more than most of the time, but certainly not all of the time'. |
@nzjrs I think understand what you say John. I don't understand instead what you suggest to do. Maybe a statistical determination of timeout at runtime? |
Unless there are some reasonable unit-tests or ways to reproduce this I can't really offer a prediction. I'm also starting to think this homegrown real-time messaging stack is never going to be as well tested as a more robust and tested one (autobahn maybe?) |
Using exernal comunication libraries could be a solution. But you know my adversity about this. |
It's a javascript library, so we just ship it with the library.... we don't have to use the server side components if we dont want to. |
I would prefer not depending on other "big" libraries like autobahn, but if Also, I'm super happy with the current status of the communication of the
|
Didn't know that, sounds nice!
|
I did have some other autobahn like (the JS side only) bookmarked, I will have to try and find them. I'm sure there are many other websocket wrappers that do things like message queuing etc. |
Ok perfect. If it's only javascript we can try to use it! ;-) @nzjrs Thank you for the patience, I know that sometimes it seems that I would reinvent the wheel, but.. you already knows my motivations... |
socket.io is another option |
It also handles reconnection logic etc. If you just want to use the websocket abstraction in socket.io that is apparently called engine.io I misspoke earlier, I think socket.io is the project I was remembering, and would recommend |
The pure python server side is here https://github.com/miguelgrinberg/python-socketio (if you want to use it..., if not, just copy the code you need here (its MIT) |
I took a real quick eye to socket.io and looks great! 2015-12-04 17:50 GMT+01:00 John Stowers notifications@github.com:
|
Also this adds parameters to tune the timeout on checking if the data was sent and how big the pending messages buffer can be.
With values like 10 on bad networks this made the connection drop a lot more frequently which made the renewConnection pop a lot more.