<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AmirHossein Kargar</title>
    <description>The latest articles on DEV Community by AmirHossein Kargar (@amirhkrg).</description>
    <link>https://dev.to/amirhkrg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4277365%2F39ba4927-91cb-4c8e-adfd-1efd9e4a148a.jpg</url>
      <title>DEV Community: AmirHossein Kargar</title>
      <link>https://dev.to/amirhkrg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/amirhkrg"/>
    <language>en</language>
    <item>
      <title>How We Beat Telegram's Official Bot API Server in PHP (With Native WebSockets &amp; 291k Updates/sec)</title>
      <dc:creator>AmirHossein Kargar</dc:creator>
      <pubDate>Wed, 02 Dec 2026 02:47:24 +0000</pubDate>
      <link>https://dev.to/amirhkrg/how-we-beat-telegrams-official-bot-api-server-in-php-with-native-websockets-291k-updatessec-2k3h</link>
      <guid>https://dev.to/amirhkrg/how-we-beat-telegrams-official-bot-api-server-in-php-with-native-websockets-291k-updatessec-2k3h</guid>
      <description>&lt;p&gt;If you've ever scaled a high-traffic Telegram bot, you know the pain points of the official &lt;code&gt;telegram-bot-api&lt;/code&gt; C++ server:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;You have to compile C++ from source&lt;/strong&gt; (which takes forever and eats gigabytes of RAM during builds) just to unlock local file limits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delivery is stuck in the HTTP era:&lt;/strong&gt; You either deal with the latency of Long Polling or the HTTP overhead, SSL certs, and connection churn of Webhooks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero native WebSocket support:&lt;/strong&gt; Want real-time bidirectional communication without spinning up an HTTP server for every bot? You're out of luck.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We built &lt;strong&gt;&lt;a href="https://github.com/laraXgram/APIServer" rel="noopener noreferrer"&gt;LaraGram APIServer&lt;/a&gt;&lt;/strong&gt; (&lt;code&gt;laraxgram/apiserver&lt;/code&gt;) to fix this. It is a &lt;strong&gt;drop-in replacement&lt;/strong&gt; for the official Telegram Bot API server, written in PHP directly on top of &lt;strong&gt;&lt;a href="https://github.com/laraXgram/MTProto" rel="noopener noreferrer"&gt;LaraGram MTProto&lt;/a&gt;&lt;/strong&gt;—and in real-world benchmarks, it actually outperforms the official C++ binary.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Replace the Official &lt;code&gt;telegram-bot-api&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;LaraGram APIServer speaks the exact same HTTP Bot API protocol your existing bots already use—meaning you can point any bot framework (LaraGram, GrammY, Aiogram, Telethon, node-telegram-bot-api, etc.) to your local endpoint without changing a single line of business logic.&lt;/p&gt;

&lt;p&gt;On top of standard Bot API compatibility, it unlocks features the official server either restricts or lacks entirely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Native Bidirectional WebSockets:&lt;/strong&gt; Receive updates &lt;em&gt;and&lt;/em&gt; invoke Bot API methods over a single persistent WebSocket connection—no public IP, no reverse proxy, and no HTTP handshake overhead per request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;2,000 MB Uploads &amp;amp; Unlimited Downloads:&lt;/strong&gt; Bypass Telegram's standard 50 MB / 20 MB cloud limits with local file access (&lt;code&gt;file://&lt;/code&gt;) and full MTProto chunked transfers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compatible &lt;code&gt;file_id&lt;/code&gt;s:&lt;/strong&gt; Seamless &lt;code&gt;file_id&lt;/code&gt; handling compatible with standard Bot API workflows.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Bot Hosting in One Process:&lt;/strong&gt; Run and manage multiple bot tokens concurrently inside a single lightweight daemon (&lt;code&gt;active_bot_count&lt;/code&gt; scaling cleanly without spawning separate C++ processes).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero C++ Compilation:&lt;/strong&gt; Install globally via Composer (&lt;code&gt;composer global require laraxgram/apiserver&lt;/code&gt;) and launch it from anywhere with a single command—powered out of the box by &lt;strong&gt;Surge&lt;/strong&gt; (Swoole / Open Swoole / RoadRunner / FrankenPHP).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language-Agnostic &amp;amp; Ecosystem-Ready:&lt;/strong&gt; Works seamlessly with &lt;strong&gt;any&lt;/strong&gt; Bot API client in any language—and if your bot is built with &lt;strong&gt;LaraGram v4&lt;/strong&gt;, you also get native integration with &lt;strong&gt;Sentinel&lt;/strong&gt; for real-time update debugging and queue metrics.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Killer Feature: Native WebSockets (Updates + Method Calls)
&lt;/h2&gt;

&lt;p&gt;Webhooks are great until you hit burst traffic. Every incoming update triggers a separate HTTP request, TLS/TCP overhead, and payload serialization—and every outgoing &lt;code&gt;sendMessage&lt;/code&gt; or &lt;code&gt;getChat&lt;/code&gt; requires &lt;em&gt;another&lt;/em&gt; HTTP round-trip.&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;LaraGram APIServer's WebSocket transport&lt;/strong&gt;, your bot opens &lt;strong&gt;one persistent connection&lt;/strong&gt; and handles everything asynchronously:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Incoming updates&lt;/strong&gt; are pushed immediately to your bot with sub-millisecond latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Outgoing API method calls&lt;/strong&gt; (like &lt;code&gt;sendMessage&lt;/code&gt;, &lt;code&gt;editMessageText&lt;/code&gt;, &lt;code&gt;answerCallbackQuery&lt;/code&gt;) are sent right back over the &lt;em&gt;exact same socket&lt;/em&gt;—eliminating HTTP headers and connection pooling bottlenecks.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Benchmarks: LaraGram APIServer vs. Official &lt;code&gt;telegram-bot-api&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;We ran two sets of benchmarks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Direct Head-to-Head (&lt;code&gt;getMe&lt;/code&gt; throughput &amp;amp; 24-hour &lt;code&gt;systemd&lt;/code&gt; resource usage)&lt;/strong&gt; against the official C++ &lt;code&gt;telegram-bot-api&lt;/code&gt; binary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transport Stress Tests&lt;/strong&gt; comparing &lt;strong&gt;WebSocket vs. Webhook vs. Long Polling&lt;/strong&gt; across 6 high-load scenarios.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  1. Head-to-Head: LaraGram APIServer vs. Official C++ Bot API
&lt;/h3&gt;

&lt;p&gt;Across 3 × 1,000 &lt;code&gt;getMe&lt;/code&gt; runs and continuous 24-hour production monitoring via &lt;code&gt;systemd&lt;/code&gt; (&lt;code&gt;CPUUsageNSec&lt;/code&gt; and peak RSS memory):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Official Bot API (C++)&lt;/th&gt;
&lt;th&gt;LaraGram APIServer (v0.6.1)&lt;/th&gt;
&lt;th&gt;Improvement&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;24-Hour Total CPU Time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~30 minutes&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&amp;lt; 30 seconds&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&amp;gt; 60× less CPU time&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Throughput (Concurrency 1)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1,245.5 RPS&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1,538.5 RPS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+23.5% faster&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Throughput (Concurrency 4)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;881.5 RPS&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;951.8 RPS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+8.0% faster&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server CPU / 1,000 req (c=1)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;222.2 ms&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;187.0 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-15.8% CPU&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server CPU / 1,000 req (c=4)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;287.0 ms&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;220.6 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-23.1% CPU&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;p99 Latency (c=1)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;16.79 ms &lt;em&gt;(spike)&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.597 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;10.5× lower tail latency&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Peak Systemd Memory (9 bots)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;116.3 MiB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Rock-solid stability (0/6,000 errors)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Even in real-world 24/7 operation running &lt;strong&gt;9 active bots simultaneously&lt;/strong&gt;, LaraGram APIServer consumed &lt;strong&gt;under 30 seconds of total CPU time over 24 hours&lt;/strong&gt; (compared to &lt;strong&gt;~30 minutes&lt;/strong&gt; on the official C++ binary—a &lt;strong&gt;60× reduction&lt;/strong&gt;), while RSS memory hovered around ~116–142 MB with &lt;strong&gt;zero dropped requests&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Transport Showdown: WebSocket vs. Webhook vs. Long Polling
&lt;/h3&gt;

&lt;p&gt;Where LaraGram APIServer truly pulls away is its WebSocket layer. Here is how WebSocket stacks up against Webhook and Long Polling across massive update bursts and high-concurrency API calls:&lt;/p&gt;

&lt;h4&gt;
  
  
  Scenario A: High Volume (100,000 updates arriving at once)
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;WebSocket&lt;/th&gt;
&lt;th&gt;Webhook&lt;/th&gt;
&lt;th&gt;Long Polling&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total Delivery Time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.34 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;7.8 s&lt;/td&gt;
&lt;td&gt;2.0 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Throughput (updates/sec)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;291,000&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;13,000&lt;/td&gt;
&lt;td&gt;50,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server CPU per update&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.5 μs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;81 μs&lt;/td&gt;
&lt;td&gt;15 μs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Network bytes per update&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;231&lt;/td&gt;
&lt;td&gt;580&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;207&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Packet Count&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;578&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;200,404&lt;/td&gt;
&lt;td&gt;2,037&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Client CPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;409 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4,236 ms&lt;/td&gt;
&lt;td&gt;914 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Peak Server Memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;140 MB&lt;/td&gt;
&lt;td&gt;147 MB&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;136 MB&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; WebSocket delivers 100k updates in &lt;strong&gt;340 milliseconds&lt;/strong&gt; at &lt;strong&gt;291,000 updates/sec&lt;/strong&gt;—&lt;strong&gt;22.9× faster than Webhooks&lt;/strong&gt; while using &lt;strong&gt;54× less server CPU per update&lt;/strong&gt; (&lt;code&gt;1.5 μs&lt;/code&gt; vs &lt;code&gt;81 μs&lt;/code&gt;) and &lt;strong&gt;346× fewer network packets&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Scenario B: Accumulated Queue Drain (100,000 queued updates)
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;WebSocket&lt;/th&gt;
&lt;th&gt;Webhook&lt;/th&gt;
&lt;th&gt;Long Polling&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Queue Drain Time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0.35 s&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;7.8 s&lt;/td&gt;
&lt;td&gt;2.1 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Throughput (updates/sec)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;286,000&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;13,000&lt;/td&gt;
&lt;td&gt;48,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server CPU per update&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.1 μs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;78 μs&lt;/td&gt;
&lt;td&gt;14 μs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Packet Count&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;629&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;200,412&lt;/td&gt;
&lt;td&gt;2,026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Client CPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;413 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4,211 ms&lt;/td&gt;
&lt;td&gt;924 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; When your bot reconnects after downtime with 100k pending updates, WebSocket drains the entire backlog in &lt;strong&gt;350 milliseconds&lt;/strong&gt; at &lt;strong&gt;286,000 updates/sec&lt;/strong&gt;—over &lt;strong&gt;22× faster&lt;/strong&gt; than Webhooks.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Scenario C: Method Invocation (20,000 API requests, 50 concurrent)
&lt;/h4&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Over WebSocket&lt;/th&gt;
&lt;th&gt;HTTP (keep-alive)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Requests per second&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;28,675 RPS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;8,162 RPS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Latency (p50 / p99)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.7 / 2.5 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;5.0 / 15.4 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server CPU per request&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;9.9 μs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;33 μs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Network bytes per request&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;94 B&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;436 B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Client CPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;764 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;3,560 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Takeaway:&lt;/strong&gt; Calling Bot API methods over WebSocket delivers &lt;strong&gt;3.5× higher throughput&lt;/strong&gt; (&lt;strong&gt;28.6k RPS vs. 8.1k RPS&lt;/strong&gt;), cuts bandwidth per request by &lt;strong&gt;78%&lt;/strong&gt; (&lt;code&gt;94 B&lt;/code&gt; vs &lt;code&gt;436 B&lt;/code&gt;), and keeps p99 latency flat at &lt;strong&gt;2.5 ms&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Scenario D: Sustained Load &amp;amp; Idle Efficiency
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sustained Load (2,000 updates/sec for 15s):&lt;/strong&gt; WebSocket maintained a &lt;strong&gt;0.74 ms p50 / 1.2 ms p99&lt;/strong&gt; latency with a &lt;strong&gt;6.0 ms max spike&lt;/strong&gt; (compared to a &lt;strong&gt;17.0 ms&lt;/strong&gt; spike on Webhooks) while using just &lt;strong&gt;12% of 1 CPU core&lt;/strong&gt; (vs. &lt;strong&gt;43%&lt;/strong&gt; for Webhooks).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single Updates (200 updates @ 20 ms intervals):&lt;/strong&gt; &lt;strong&gt;0.69 ms p50 / 1.7 ms p99&lt;/strong&gt; latency and only &lt;strong&gt;121 ms&lt;/strong&gt; total client CPU (vs. 208 ms on Webhook and 545 ms on Long Polling).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idle (60s open connection, 0 updates):&lt;/strong&gt; Virtually zero overhead (&lt;strong&gt;3.7 ms&lt;/strong&gt; total CPU for WebSocket over 60 seconds).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Getting Started in 60 Seconds
&lt;/h2&gt;

&lt;p&gt;You don't need a LaraGram project to use LaraGram APIServer—you can install it globally as a standalone server and use it with &lt;strong&gt;any&lt;/strong&gt; Telegram bot library (Python, Node.js, Go, Rust, PHP, etc.):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Install globally via Composer&lt;/span&gt;
composer global require laraxgram/apiserver

&lt;span class="c"&gt;# 2. Start the server (make sure Composer's global vendor/bin is in your PATH)&lt;/span&gt;
laragram-server --api-id=YOUR_API_ID --api-hash=YOUR_API_HASH --local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once running, simply point your bot's API base URL to your local server (e.g., &lt;code&gt;http://127.0.0.1:8081&lt;/code&gt;), or connect directly via WebSocket to unlock full bidirectional streaming—no changes to your existing bot code required.&lt;/p&gt;




&lt;h2&gt;
  
  
  Check Out the Code &amp;amp; Docs
&lt;/h2&gt;

&lt;p&gt;LaraGram APIServer is completely open-source under the MIT license:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/laraXgram/APIServer" rel="noopener noreferrer"&gt;github.com/laraXgram/APIServer&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Official Documentation:&lt;/strong&gt; &lt;a href="https://laraxgram.github.io/v4/apiserver" rel="noopener noreferrer"&gt;laraxgram.github.io/v4/apiserver&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LaraGram Framework:&lt;/strong&gt; &lt;a href="https://github.com/laraXgram/LaraGram" rel="noopener noreferrer"&gt;github.com/laraXgram/LaraGram&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're building high-throughput Telegram bots, userbots, or Mini Apps, give it a star on GitHub and let us know what benchmarks you hit!&lt;/p&gt;

</description>
      <category>php</category>
      <category>telegram</category>
      <category>opensource</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
