Views: 4926
Last Modified: 05.04.2022

Attention! Provided settings are listed outside the scope of the Virtual Appliance menu. This means that the details below are provided for informational purposes only and should be used with clear understanding of your actions and under your own liability. Bitrix24 technical support reviews the questions related to Virtual Appliance menu items only.

  Organizing web-sockets

Organized web-sockets (ws/wss protocols) are the key when additional settings are required to avoid terminated connection via timeout by the network equipment.

Network equipment settings are not subject of this article, it presupposes that all settings are in order and web socket support is enabled.

This article's main focus is on a situation when port for ws/wss protocols must be moved for correct operation.

1. Virtual Appliance configuration

Create a config file /etc/nginx/bx/site_ext_enabled/rtc_ext.conf:

server {
	listen 1137;
	listen 1139 default_server ssl;

	#access_log off;

	server_name _;

	# ssl settings
	include bx/conf/ssl.conf;


	# Include im subscrider handlers
	include bx/conf/im_subscrider.conf;

	location / {
		deny all; 
	}
}
Pay a close attention SSL (https) settings. Use the same settings and the same SSL certificate used on target site for connecting future Push server. Settings example can be taken from config file: /etc/nginx/bx/site_enabled/rtc-server.conf.

Do not forget to re-launch nginx after all adjustments are implemented.

CentOS 6:

service nginx restart

CentOS 7:

systemctl restart nginx.service

  2. Ports opening

Open ports in Bitrix Virtual Appliance:

iptables:

iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 1137 -j ACCEPT
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 1139 -j ACCEPT
iptables-save > /etc/sysconfig/iptables

firewalld:

firewall-cmd --permanent --add-port=1137/tcp
firewall-cmd --permanent --add-port=1139/tcp
firewall-cmd --reload

  3. Change site settings

Add selected ports into config file bitrix/.settings.php:

'pull_s1' => 'BEGIN GENERATED PUSH SETTINGS. DON\'T DELETE COMMENT!!!!',
'pull' => Array(
    'value' =>  array(
...
        'path_to_websocket' => 'ws://#DOMAIN#:1137/bitrix/subws/',
        'path_to_websocket_secure' => 'wss://#DOMAIN#:1139/bitrix/subws/',
...
    ),
),
'pull_e1' => 'END GENERATED PUSH SETTINGS. DON\'T DELETE COMMENT!!!!',

Finally, check the performance via browser.





Courses developed by Bitrix24