MyChat Scripts: function mKillCID, disconnect the online application
The function for disconnecting one connection from the server. The connection is an instance of MyChat application or service.
As a rule, all MyChat applications except MyChat WEB services (Kanban, forum, WEB chat, MyChat Guest, and Admin Panel) automatically reconnect to the server after disconnection.
Syntax
function mKillCID(iCID: int64): integer;
Parameters and return values
Parameter |
Type |
Value |
iCID |
int64 |
connection unique ID. |
Function result
0 |
All OK, connection terminated successfully; |
-1 |
unknown or incorrect CID; |
-2 |
CID must be above zero. |
Example
The script for immediate disconnection of all users of the built-in forum and the system for Kanban project management.
var
sCIDList: string;
iCount: integer;
begin
iCount := 0;
sCIDList := mGetCIDSByClientType('forum,kanban');
while length(sCIDList) > 0 do
if mKillCID(StrToInt64(Fetch(sCIDList, ','))) = 0 then inc(iCount);
mLogScript('Disconnected: ' + IntToStr(iCount) + ' web applications', '');
end.
Script work result
[00:06:17] (Log "mKillCID"): Disconnected: 2 web applications
[00:06:17] (Run "mKillCID"): Script operation time: 22 ms
[00:06:17] (Run "mKillCID"): Script done successfully.