code:
var bot = new TelegramBot(token, {polling: true});
bot.on('message', function (msg) {
console.log(JSON.stringify(msg));
});
error:
Unhandled rejection TimeoutError: operation timed out
at afterTimeout (/path/to/project/node_modules/bluebird/js/main/timers.js:16:15)
at timeoutTimeout (/path/to/project/node_modules/bluebird/js/main/timers.js:59:9)
at Timer.listOnTimeout (timers.js:92:15)
The same for me after 1-2 minutes of polling.
Try with this code:
var bot = new TelegramBot(token, {polling: {timeout: 10, interval: 2000}});
Sounds like a Telegram server error. Blame them please.
But how could i handle this and manually reconnect?
I thought client must handle server and network errors and do not any unexpected behavior.
Most helpful comment
Sounds like a Telegram server error. Blame them please.