Bug Report
I have read:
I am using the latest version of the library.
Expected Behavior
After calling stopPolling no listener should be left waiting for polling-related events: if no other event handlers are active, Node's event loop should terminate.
Actual Behavior
A TLSSocket object starts listening on a socket when polling starts. stopPolling doesn't stop it.
This is because HTTPS requests to the Telegram server use the forever agent (src/telegram.js:230), and the agent is not cancelled by stopPolling (which calls this._polling.stop(): src/telegramPolling.js:57)
Steps to reproduce the Behavior
Run the following piece of code:
const TelegramBot = require('node-telegram-bot-api');
const bot = new TelegramBot(TOKEN, {polling:true});
bot.stopPolling();
This program never terminates as the polling request is still active.
I have read:
I am using the latest version of the library.
Expected Behavior
After calling
stopPollingno listener should be left waiting for polling-related events: if no other event handlers are active, Node's event loop should terminate.Actual Behavior
A
TLSSocketobject starts listening on a socket when polling starts.stopPollingdoesn't stop it.This is because HTTPS requests to the Telegram server use the forever agent (src/telegram.js:230), and the agent is not cancelled by
stopPolling(which callsthis._polling.stop(): src/telegramPolling.js:57)Steps to reproduce the Behavior
Run the following piece of code:
This program never terminates as the polling request is still active.