Create connection
Creates a WebSocket connection
- Parameters
- Advanced call ?
Function CreateConnection(Val Address, Val Tls = Undefined, Val Proxy = Undefined, Val Headers = Undefined, Val Logging = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Address | - | String | ✔ | Address and port |
| Tls | - | Structure Of KeyAndValue | ✖ | TLS settings, if necessary. See GetTlsSettings |
| Proxy | - | Structure Of KeyAndValue | ✖ | Proxy settings, if required. See GetProxySettings |
| Headers | - | Map Of KeyAndValue | ✖ | Map of additional HTTP headers for handshake |
| Logging | - | Structure Of KeyAndValue | ✖ | Logging settings. See GetLoggingSettings |
Returns
Map Of KeyAndValue, Arbitrary - Client object or map with error information
| Parameter | Description |
|---|---|
| addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
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;
Result = OPI_WebSocket.CreateConnection(Address, TLSSettings, ProxySettings, Headers);
Result
"AddIn.OPI_WSClient.Main"