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

connect through state very temperamental #39

Open
mitchcapper opened this issue May 17, 2017 · 5 comments
Open

connect through state very temperamental #39

mitchcapper opened this issue May 17, 2017 · 5 comments

Comments

@mitchcapper
Copy link
Collaborator

For example calling after awaiting the connect:

fs.writeFileSync("state.json", JSON.stringify(await api.getState()));

then for when connecting doing:

let state = fs.readFileSync("state.json", 'utf8');
let api = await skypeHttp.connect({ verbose: true, state: JSON.parse(state) });

will periodically not connect properly, and will not throw an error either. I have added inside the normal connect T/C:
await api.setStatus("Online");
as if it doesn't connect right this command will fail.

skypeHttp.connect state resuming should always throw an error if resuming from state does not work (even if we have to make a no-op call after loading state to the skype service to make sure we are all good).

@demurgos
Copy link
Member

You are right, restoring the state should use a no-op (but maybe not setStatus) to ensure that we are properly logged in. I was using it while developing the feature to restore from a saved state but it got lost before the merge into master.
The connect function could do a getConversations or getContacts at the end. The first one checks for the registration token, the second one for the Skype token.

@mitchcapper
Copy link
Collaborator Author

Whatever the smallest request the better (from a speed/BW point of view). We also should add the reconnect option as discussed (so users do not need to re-create the instance to reconnect).

@mitchcapper
Copy link
Collaborator Author

I am going to update this and say while the current error and complete re-create works 95% of the time, I have found there is 5% of the time where it will not be getting proper events and not throwing an error leading to missed events. I have yet to find a solution to this.

@demurgos
Copy link
Member

demurgos commented Sep 12, 2017

Thank you for working on this issue.

@demurgos
Copy link
Member

Restoring the state seems to work pretty fine for the Skype token but fail with the registration token if it stopped for more than a few minutes. We may need to issue a new registration token (endpoint) to fix this.

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

No branches or pull requests

2 participants