Getting internal technical data about running MyChat Server.

 

Syntax

function mGetServerTechInfoInt(iID: integer): integer;

 

Parameters and return values

Parameter

Type

Value

iID

integer

parameter, which information you need to get. Possible variants:

0 — number of current active client connections (online);

1 — maximum number of connections for this license.

 

Function result

Integer. If you specify a nonexistent index, the function returns -1.

 

Example

Script to manage the maximum number of connections. Works with OnClientConnect event. It is necessary to provide a guaranteed pool of 5 connections for MyChat Integration API for which the connections take place from the local IP 192.168.10.1:


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.


Script work result

If a connection does not take place from IP 192.168.10.1 and a number of free connections less than 5, then user application will disconnect from the server.

 

See also

OnClientConnect