RocketChat / Rocket.Chat.js.SDK

Utility for apps and bots to interact with Rocket.Chat via DDP and/or API
MIT License
136 stars 95 forks source link

Connection to driver getting lost/disconnected automatically #70

Open aswanyaugustine opened 5 years ago

aswanyaugustine commented 5 years ago

after a particular may be a specific time after there is no new change in subscribed collection (no new message ), the driver getting automatically disconnected due to which new message is not detected

galshiff commented 4 years ago

Same here with the api. api.loggedIn() return true, but when I try to do api.get request it return error: "you must be logged into do this". Any help?

ohadetsion commented 4 years ago

Same problem as @galshiff wrote.. Very strange because the api.loggedIn() return true so i think maybe there is a socket which got somehow disconneced ? Help plz :)

felipetomm commented 3 years ago

Same problem here.. my solution is add an event on_close in asteroid.ddp. This event call main function, and then, reconnect bot.

export const runbot = async () => {
    asteroid = await driver.connect();
    asteroid.ddp.on('socket_close', async () => await runbot());
    await driver.login();
    await driver.subscribeToMessages();
    await driver.respondToMessages(__processMessages);
}

SDK ver. 0.2.9-2