-
Notifications
You must be signed in to change notification settings - Fork 12
Webhooks vs. Polling
While many can fight for days over their preferred method of updates, be it from phones, computers, to Telegram bots, no clear winner is evident. With the Telegram Bot API, they let it have it your way, and we will act no different. This article will outline the general benefits and costs to using either method, more specifically to jTelegram.
Polling, by far, is the easiest to implement and most lightweight. You simply just pass in your options, and jTelegram will take care of it for you. However, you lose the ability of high throughput and lose the efficiency and speed that you would get with web hooks. If your bot isn't that popular and you want to get going ASAP, this option is definitely the way to go. You can find the setup process for long polling on our Home Page
Webhooks are more efficient but come at a loss at a greater JAR footprint (+1MB from Vert.x) and a more complex setup process. They are a much better choice for popular bots and/or a multiple bot setup. Webhooks don't face a maximum throughput besides 100 connections max. per bot, which is more than capable to handle whatever load you throw at it. If you're dealing with a lot of traffic and using multiple bots, the benefits of Webhooks will be extremely evident over time. You can find our tutorial for webhooks here.