Get next connection data
Gets data from the buffer of the next active connection in the queue where there are incoming data
- Parameters
- Advanced call ?
Function GetNextConnectionData(Val ServerObject, Val Timeout = 1000) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| ServerObject | - | Arbitrary | ✔ | Object of running server component |
| Timeout | - | Number | ✖ | Waiting period for new data if the queue is empty (in ms) |
Returns
Map Of KeyAndValue - Execution result
This method has no additional advanced call parameters.
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
// Server start
LaunchPort = 9894;
ServerObject = OPI_WebSocket.StartServer(LaunchPort);
// Client connect to server
ConnectionAddress = "ws://127.0.0.1:9894";
ClientObject = OPI_WebSocket.CreateConnection(ConnectionAddress);
If Not OPI_WebSocket.IsClientObject(ClientObject) Then
Raise OPI_Tools.JSONString(ClientObject);
Else
// Client send
Message = "Hello from client!";
Sending = OPI_WebSocket.SendTextMessage(ClientObject, Message);
EndIf;
// Server receive
Result = OPI_WebSocket.GetNextConnectionData(ServerObject, 5000);
Result
{
"address": "127.0.0.1:62956",
"connectionId": "aa4dc2b3-6767-40fc-921a-b50caa87454e",
"isActive": true,
"message": "<Binary data>",
"result": true
}