MyChat Scripts: mIntegrationTurboSMSPing, checking connections with the service TurboSMS
Checking connection with the service TurboSMS.
Syntax
function mIntegrationTurboSMSPing(var sJSONResponse: string): integer;
Parameters and return values
Parameter |
Type |
Value |
sJSONResponse |
string |
JSON object, full response from the service. |
Function result
-1 |
service is off, no access to it, or another error occurred; |
1 |
service is on, connection established, connection token specified correctly. |
Example
The script executed 2 times, the first time when there was no connection to TurboSMS via the internet (WiFi is off), and the second time when the network connection was working fine.
var
iResult: integer;
sJSONResponse: string;
begin
iResult := mIntegrationTurboSMSPing(sJSONResponse);
mLogScript('Ping response code: ' + IntToStr(iResult), '');
mLogScript(sJSONResponse, '');
end.
Script work result
[14:15:00] (Log "TurboSMSPing"): Ping response code: -1
[14:15:00] (Log "TurboSMSPing"): NETWORK ERROR 11001, "Host not found"
[14:15:00] (Run "TurboSMSPing"): Script operation time: 3 ms
[14:15:00] (Run "TurboSMSPing"): Script done successfully.
[14:15:13] (Log "TurboSMSPing"): Ping response code: 1
[14:15:13] (Log "TurboSMSPing"): {"response_code":1,"response_status":"PONG","response_result":null}
[14:15:13] (Run "TurboSMSPing"): Script operation time: 282 ms
[14:15:13] (Run "TurboSMSPing"): Script done successfully.
See also
Help page for TurboSMS service via HTTP API, commands, answers, possible errors