Get connection list
Gets the list of connections
Function GetConnectionList(Val ServerObject) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| ServerObject | - | Arbitrary | ✔ | Object of running server component |
Returns: Map Of KeyAndValue - Execution result
tip
The list displays active connections and closed connections with unprocessed data in the buffer
caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
LaunchPort = 9877;
ServerObject = OPI_TCP.StartServer(LaunchPort);
// Connect to running server
ConnectionAddress = "127.0.0.1:9877";
Client1 = OPI_TCP.CreateConnection(ConnectionAddress);
Client2 = OPI_TCP.CreateConnection(ConnectionAddress);
If Not OPI_TCP.IsClientObject(Client1) Then
Raise OPI_Tools.JSONString(Client1);
EndIf;
If Not OPI_TCP.IsClientObject(Client2) Then
Raise OPI_Tools.JSONString(Client2);
EndIf;
Result = OPI_TCP.GetConnectionList(ServerObject);
Result
{
"connections": [
{
"address": "127.0.0.1:41910",
"canRead": true,
"canWrite": true,
"connectionId": "2caa9345-7808-4896-8d7e-6826de929d2c"
},
{
"address": "127.0.0.1:41914",
"canRead": true,
"canWrite": true,
"connectionId": "23f36e06-0db2-4185-bc42-40d46ddfb868"
}
],
"result": true
}