Setting up the 1C-Bitrix Push and Pull module

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages

Setting up Push and Pull module for 1C-Bitrix

Online chat updates only on page reload. Notifications of new order arrive with a delay of several minutes. The "live feed" in Bitrix24 corporate portal doesn't update in real time. All this — consequences of an unconfigured Push and Pull module, which provides two-way communication between server and browser.

What Push and Pull module does

The pull module (Bitrix ID: pull) provides server push of events to client. Technically implemented through multiple transports:

  • WebSocket — persistent connection, minimal delay (1–5 ms)
  • Long Polling — client keeps HTTP request open, server responds when there's an event
  • Server-Sent Events — one-way stream from server

Transport selection happens automatically. For WebSocket you need a separate NodeJS server, included in Bitrix VM or installed separately.

Module installation and activation

In admin panel: "Marketplace" → "Installed Solutions" → find push and pull module. If not installed — "Marketplace" → "All Solutions" → search "Push and Pull".

After installation /bitrix/modules/pull/ appears. Settings: "Settings" → "Product Settings" → "Push and Pull".

Key module parameters:

  • Push server — address of NodeJS Push server (e.g., http://localhost:9010)
  • Pull server (Long Polling) — address for long polling (can be the same)
  • Security key — shared secret for message signing

Configuration via b_option

Settings stored in table b_option, module pull:

SELECT * FROM b_option WHERE MODULE_ID = 'pull';

Key parameters:

  • PUSH_ENABLE — enabling push notifications
  • PULL_SERVER_ENABLED — enabling pull server
  • PUSH_SERVER_URL — URL of NodeJS push server
  • PULL_SERVER_URL — pull server URL
  • PUSH_SECURITY_KEY — security key

Long Polling without NodeJS

If NodeJS not installed, module works in Long Polling mode via PHP. For this you need to configure separate location in Nginx that will hold connections:

location ^~ /bitrix/pub/ {
    proxy_pass http://127.0.0.1:9000; # PHP-FPM
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_read_timeout 25;
    proxy_send_timeout 25;
    # Don't buffer response — send immediately
    proxy_buffering off;
    proxy_cache off;
}

Path /bitrix/pub/ — standard endpoint for pull requests in Bitrix.

Testing functionality

In browser open DevTools → Network. Find request to /bitrix/pub/ or to push server. It should hang open (pending) — this is long polling or SSE connection.

Send test event from PHP:

use Bitrix\Pull\Event;
use Bitrix\Pull\Push;

// Send event to specific user
$push = new Push(1); // userId = 1
$push->addUser(1);
$push->setMessage([
    'module_id' => 'im',
    'command' => 'test',
    'params' => ['text' => 'Test message']
]);
$push->send();

// Via static method
\CPullWatch::AddToStack('TEST_CHANNEL', [
    'module_id' => 'main',
    'command' => 'test',
    'params' => []
]);
\CPullStack::Send();

Common issues

Channel doesn't connect, error 502. NodeJS push server not running or crashed. Check:

systemctl status push-server
# or
ps aux | grep node

Long polling works, but delay is large. proxy_read_timeout in Nginx less than 20 seconds — Nginx breaks connection before server responds. Client immediately reconnects, creating extra load.

Too many connections, worker_connections overflow. At 1000 online users — 1000 hanging HTTP connections. Need to increase worker_connections in Nginx and system file descriptor limit:

# /etc/security/limits.conf
nginx soft nofile 65535
nginx hard nofile 65535

# Nginx
events {
    worker_connections 8192;
    use epoll;
    multi_accept on;
}

Messages lost on PHP-FPM restart. Event queue b_pull_stack cleared by agent. On FPM restart agents don't execute — events accumulate. After restart execute manually or configure cron for Bitrix agents.