Script event for MyChat Server: OnRemoteUserRequest
The event that occurs when calling the server script from the client over the network.
Principle of operation:
- MyChat Client creates JSON object with data.
- MyChat Client sends a command on the server for calling the server script from the section "User defined scripts\OnRemoteUserRequest", specifies the script name and transfer the JSON object with data in the section.
- The server executes the script by sending the client UIN and CID, and the JSON object with data.
- The script can handle the JSON object and form the answer that is transfer back over the network to MyChat after the end of script work. The answer must be in JSON format.
Event template
function OnRemoteUserRequest(iCID, iUIN: integer; sJSONData: string): string;
begin
// your own code
result := '{}';
end;
begin
end.
You can write any of your code instead of the comment. The function must return JSON object in text format.
Description of parameters
Parameter |
Type |
Value |
iCID |
integer |
Connection ID of the client, unique session identifier in the online structure of network connections to the server; |
iUIN |
integer |
numeric identifier of a user; |
sJSONData |
string |
JSON object with data that was sent by MyChat Client. |
Return value
The function returns any JSON object which is sent to the client that called the server script.