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

Leaving devices are not being recorded #66

Open
QuentinRoy opened this issue Aug 16, 2017 · 6 comments
Open

Leaving devices are not being recorded #66

QuentinRoy opened this issue Aug 16, 2017 · 6 comments
Assignees
Labels

Comments

@QuentinRoy
Copy link
Member

QuentinRoy commented Aug 16, 2017

It seems that ecology.getAvailableDevices does not update the devices that have left. Once a device has been connected, it is always returned by this method.
Experienced when using cordova-ecology-plugin and reacology-model-sync.

@anurooppv
Copy link
Collaborator

Just to understand more about this issue. Do you call disconnect method when the device leaves ecology? In Android, we call disconnect method in onDestroy() method.

@QuentinRoy
Copy link
Member Author

Well. For a client, disconnect means that you lost access to the server. I am not sure what is the relationship with onDestroy(). When working on the reacology boilerplate, if I have device A (server) and B connected, then close the app on B, A keeps thinking that B is here.

@anurooppv
Copy link
Collaborator

For a native app, onDestroy() method is called when you close the app. so ecology is notified about the disconnection if we call disconnect method in onDestroy().

Similarly, we should implement it in cordova to notify ecology. Otherwise how will ecology know. In my demo apps, I used document.addEventListener("backbutton", yourCallbackFunction, false); to implement disconnect method.

@QuentinRoy
Copy link
Member Author

QuentinRoy commented Aug 23, 2017

OK, I think we have a spec problem here. Notifying the client that he disconnected himself is not very useful (though it does count as a disconnection). Again, the point of the disconnect event is to be informed on the status of your connection with the ecology (that is currently centralized on the server, so this is really about connection to the server). It might be because you disconnected manually, but more often than not, that is because the connection has been interrupted. Maybe because the server app has been closed, or because the server device is not in range, or because the network channel got broken for whatever reason. This is what we need to detect..

@QuentinRoy
Copy link
Member Author

This is true in the other direction of course. The server needs to know if a client has been disconnected even if that client did not call disconnect. Of course using disconnect is good because this means we can warn the server quicker. But sometimes, the device just got out of range and the server should still be able to detect that device is not available anymore. getAvailableDevices is supposed to return the devices that are available, not just the device that were here and haven't called disconnect yet...

@QuentinRoy
Copy link
Member Author

QuentinRoy commented Aug 23, 2017

A very simple way to test it is to launch the reacology-boilerplate.
With only one device you should see "Waiting for my friend" on the server and "Not connected" on the other device.
Once the second device is here the interface appear.
Turn off the bluetooth, close one of the app, or bring a device out of range and we should be back on the initial configuration. This is currently not the case. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants