MyChat add-ons: developing, technical questions, testing, documentation and other useful information
User avatar
Alona Kutsenko
The task: a company with MyChat Server for 150 connections uses 1C:Enterprise notification system for employees. MyChat Server is "full", and there are no free connections.

The company plans to purchase MyChat Server license extension, but for now, you need to provide a trouble proof notification system that would work even if there are no free connections left.

The script is set on OnClientConnect event, and gives a guaranteed pool of free connections for a specified IP address that used for sending notifications from 1C:

reserved-connections.png
Creating a guaranteed pool for free connections to MyChat Server
reserved-connections.png (46.31 KiB) Viewed 12933 times

Script source:
Code: Select all
function OnClientConnect(iCID: integer; sIP: string; iMajorVer, iMinorVer: integer): boolean;
var
  iMax, iCurrent: integer;
  bFlag: boolean;
begin
  bFlag := true;
 
  iCurrent := mGetServerTechInfoInt(0);
  iMax     := mGetServerTechInfoInt(1);
 
    if ((iMax - iCurrent) <= 5) and (sIP <> '192.168.10.1')  then bFlag := false;

  result := bFlag;
end;

begin

end.