[FIX] Start loop searching for rooms updates only when connection goes down and SDK has userId (#613)

This commit is contained in:
Diego Mello 2019-02-07 18:28:39 -02:00 committed by GitHub
parent 833bf1e706
commit c9bf599bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 8 deletions

View File

@ -16,23 +16,21 @@ export default async function subscribeRooms() {
timer = setTimeout(() => {
clearTimeout(timer);
timer = false;
if (this.sdk.userId) {
store.dispatch(roomsRequest());
loop();
}
store.dispatch(roomsRequest());
loop();
}, 5000);
};
this.sdk.onStreamData('connected', () => {
if (this.sdk.userId) {
store.dispatch(roomsRequest());
}
store.dispatch(roomsRequest());
clearTimeout(timer);
timer = false;
});
this.sdk.onStreamData('close', () => {
loop();
if (this.sdk.userId) {
loop();
}
});
this.sdk.onStreamData('stream-notify-user', protectedFunction((ddpMessage) => {