Open thomaskahabka opened 3 years ago
Hello thanks for reporting. We will see if we can replicate and report back.
Thank you for looking into this. We stopped using reconnect() now and switched to re-validating via JWT - which actually is much safer anyway.
Here is what we are going to use:
import * as Convergence from '@convergence/convergence';
function patchReconnect(domain: Convergence.ConvergenceDomain) {
// Patch Convergence Connection class to reconnect with the original JWT instead of a reconnect token.
// Reconnecting with a reconnect token appears to be broken atm:
// https://github.com/convergencelabs/convergence-project/issues/256
const connection = (domain as any)._connection;
connection.connectWithReconnectToken = connectWithReconnectToken;
}
function connectWithReconnectToken(this: any /* ConvergenceConnection */): Promise<void> {
const gen = this._connectionRequestGenerator;
return (gen
? this._connect(gen).catch((e: any) => this._handleReconnectFailure(e))
: Promise.reject(new Error('No connectionRequestGenerator! Have you connected even once before calling reconnect()?'))
);
}
This function is called like this:
Convergence.connectWithJwt(url, jwt, {...}).then(domain => {
patchReconnect(domain);
...
});
Thank you - works like a charm, as long as the JWT token is still valid. Is there a chance to get a hook to refresh the JWT token while convergence tries to reconnect ?
Versions Please fill in all that apply:
Describe the Bug Convergence.reconnect(url,reconnectToken) never returns either a domain nor an error.
Step To Reproduce A code snippet or gist to reproduce the issue will greatly improve our response time please see: https://github.com/thomaskahabka/convergence_test for a vuejs test application.
Expected Behavior reconnect() to return a domain, as was working in rc7