Skip to main content

Get connection list

Gets the list of connections

Function GetConnectionList(Val ServerObject) Export

ParameterCLI optionTypeRequiredDescription
ServerObject-ArbitraryObject 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
// Server start
LaunchPort = 9894;
ServerObject = OPI_WebSocket.StartServer(LaunchPort);

// Creating multiple client connections
ConnectionAddress = "ws://127.0.0.1:9894";

Client1 = OPI_WebSocket.CreateConnection(ConnectionAddress);
Client2 = OPI_WebSocket.CreateConnection(ConnectionAddress);

If Not OPI_WebSocket.IsClientObject(Client1) Then
Raise OPI_Tools.JSONString(Client1);
EndIf;

If Not OPI_WebSocket.IsClientObject(Client2) Then
Raise OPI_Tools.JSONString(Client2);
EndIf;

// Getting a list of active connections on the server
Result = OPI_WebSocket.GetConnectionList(ServerObject);
Result
{
"connections": [
{
"address": "127.0.0.1:53232",
"connectionId": "ffcbd7c3-c823-48ff-a023-7a627ee7678d",
"isActive": true
},
{
"address": "127.0.0.1:53238",
"connectionId": "485c0f53-89d3-48e1-8be2-4c98eb92a334",
"isActive": true
}
],
"result": true
}