Views: 5030
Last Modified: 03.06.2024

Push & Pull

You can find more details on Pull and Pull module handling and operation in a corresponding section Push notifications are small pop-up windows that appear on screens of mobile phones and desktops, informing on important events and updates.

Learn more ...
of Bitrix24 Self-hosted For Advanced Users learning course.

Mode of operation

Push & Pull module operates in two modes:

  • continuous connection to a special Queue server;
  • in server polling mode (60-20-10).

First mode is recommended, you'll get a significant degree of interactivity, but you will have to configure the Queue server or use a complete preconfigured Bitrix Virtual Appliance.

Second mode is used when first mode is unavailable. In this case, the module will query the server each 60 seconds and check, if data is available. When data is available, a hit occurs each 10 seconds. In case of no available data, a hit initially occurs after 20 seconds and then after each 60 seconds.

In both cases (queue server or server polling), module handling remains the same (except for a main channel).

Note: be advised that establishing connection with Push and Pull server requires ports 8893-8895 to be opened, they are necessary for push and pull server operation. If a situation with failed connection persists, provide SSH access to the server.

The API is split to PHP and JS portions. Principles for managing it are presented below.

PHP and JS

Connect the module to start the operation:

if (!CModule::IncludeModule('pull'))
   return false;

and register dependency to the PULL module. Register dependency handler:

RegisterModuleDependences("pull", "OnGetDependentModule", "your_module", "CYourModulePullSchema", "OnGetDependentModule" );

Then, create your own class. Class ID

class CYourModulePullSchema
    public static function OnGetDependentModule()
        return Array(
            'MODULE_ID' => "your_module",
            'USE' => Array("PUBLIC_SECTION")

If your code works in public section, specify the following:


When in addition, administrative section is required as well, specify the following:


Before using the code, check the connection using the methods of a class CPullOptions.

Then, you can use API classes:

Server-side (PHP)
CPullStack Sending the data.
CPullWatch Sending data to subscribed users.
CPushManager Sending push notifications.

JS methods

Client side (JS)
Event BX.addCustomEvent "Trap" for Push & Pull commands.
BX.PULL.extendWatch Subscription extension.


Code for handling the above mentioned PHP methods

BX.addCustomEvent("onPullEvent", function(module_id,command,params) {
    if (module_id == "test" && command == 'check')

We subscribe to the command retrieval event (onPullEvent), and get module_id, command, params in the function; these parameters were specified when sending the command from PHP.

Example of component that handles the most complex subscription method BX.PULL.extendWatch.

Courses developed by Bitrix24