Get connection list
Gets the list of connections
- Parameters
- Advanced call ?
Function GetConnectionList(Val ServerObject) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| ServerObject | - | Arbitrary | ✔ | Object of running server component |
Returns
Map Of KeyAndValue - Execution result
This method has no additional advanced call parameters.
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:35356",
"canRead": true,
"canWrite": true,
"connectionId": "b02648b5-4908-4be3-9364-6fc9cdfc2aae"
},
{
"address": "127.0.0.1:35370",
"canRead": true,
"canWrite": true,
"connectionId": "c4b777ed-a532-4d39-8ce8-491e6c9e4a9c"
}
],
"result": true
}