Send binary message
Sends binary data to the connection
- Parameters
- Advanced call ?
Function SendBinaryMessage(Val Connection, Val Data) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Connection | - | Arbitrary | ✔ | Connection, See CreateConnection |
| Data | - | BinaryData, String | ✔ | Binary data or file path |
Returns
Map Of KeyAndValue - Execution result
This method has no additional advanced call parameters.
tip
Parameters with Binary data type can also accept file paths on disk and URLs
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
Address = "wss://127.0.0.1:8443";
NeedProxy = True;
NeedTLS = True;
Headers = New Map;
Headers.Insert("X-Trace-Id", "OPI-WS-TEST");
If NeedTls Then
TLSSettings = OPI_WebSocket.GetTlsSettings(True);
EndIf;
If NeedProxy Then
ProxyAddress = "127.0.0.1";
ProxyPort = "8071";
ProxyType = "http";
ProxtUser = "proxyuser";
ProxyPassword = "12we...";
ProxySettings = OPI_AddIns.GetProxySettings(ProxyAddress
, ProxyPort
, ProxyType
, ProxtUser
, ProxyPassword);
EndIf;
Connection = OPI_WebSocket.CreateConnection(Address, TLSSettings, ProxySettings, Headers);
SourceLine = "binary-message-" + Format(CurrentDate(), "DF=yyyyMMddhhmmss");
Data = GetBinaryDataFromString(SourceLine);
If OPI_WebSocket.IsClientObject(Connection) Then
Result = OPI_WebSocket.SendBinaryMessage(Connection, Data);
Else
Result = Connection;
EndIf;
Result
{
"result": true
}