Choose a Connection Type: Long Polling vs Webhook
masterThe library supports two ways to receive updates from Telegram via TGConnectionType:
Long Polling
Best for local development or simple bots where you don't have a public URL.
let connectionType: TGConnectionType = .longpolling()Webhook
Required for production environments where Telegram pushes updates to your server. You must provide a valid webHookURL.
let connectionType: TGConnectionType = .webhook(webHookURL: URL(string: "https://your-domain.com/webhook-path")!)// Long Polling
let connectionType: TGConnectionType = .longpolling()
// Webhook
let connectionType: TGConnectionType = .webhook(webHookURL: URL(string: "https://your-domain.com/webhook-path")!)