为什么 telegram.Bot.getUpdates() 长轮询 returns 立即?
Why does telegram.Bot.getUpdates() long polling returns immediately?
根据telegram api, the getUpdates
function receives incoming updates using long polling (wiki)。
来自维基:
If the server does not have any information available for the client
when the poll is received, instead of sending an empty response, the
server holds the request open and waits for response information to
become available. Once it does have new information, the server
immediately sends an HTTP/S response to the client, completing the
open HTTP/S Request.
那么,为什么 getUpdates()
returns 函数立即执行,即使设置了 timeout
参数?
函数调用:
bot.getUpdates(offset=lastUpdateID, timeout=120)
没有新的更新,offset=lastUpdateID 是最后一次更新。
我正在使用库 python telegram bot library
问题是我要求 offset=lastUpdateID x
,我应该要求 offset=lastUpdateID x + 1
根据telegram api, the getUpdates
function receives incoming updates using long polling (wiki)。
来自维基:
If the server does not have any information available for the client when the poll is received, instead of sending an empty response, the server holds the request open and waits for response information to become available. Once it does have new information, the server immediately sends an HTTP/S response to the client, completing the open HTTP/S Request.
那么,为什么 getUpdates()
returns 函数立即执行,即使设置了 timeout
参数?
函数调用:
bot.getUpdates(offset=lastUpdateID, timeout=120)
没有新的更新,offset=lastUpdateID 是最后一次更新。
我正在使用库 python telegram bot library
问题是我要求 offset=lastUpdateID x
,我应该要求 offset=lastUpdateID x + 1