You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2026-05-16 09:38:28 +02:00
93 lines
2.8 KiB
Plaintext
Vendored
93 lines
2.8 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 1
|
|
sidebar_class_name: doc-no-cli
|
|
description: Create connection and other functions to work with WebSocket in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, WebSocket]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
import Admonition from '@theme/Admonition';
|
|
|
|
# Create connection
|
|
Creates a WebSocket connection
|
|
|
|
|
|
|
|
<Tabs>
|
|
<TabItem value="params" label="Parameters" default>
|
|
|
|
`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 |
|
|
|
|
|
|
<div className="return-value-note">
|
|
<div className="return-value-note__title">Returns</div>
|
|
<div className="return-value-note__value">
|
|
Map Of KeyAndValue, Arbitrary - Returns WebSocket client object on successful connection or error information
|
|
</div>
|
|
</div>
|
|
|
|
</TabItem>
|
|
<TabItem value="extended" label={<span>Advanced call{' '}<a href="/docs/Start/Advanced-call" target="_blank" rel="noreferrer" title="About advanced call" onClick={(e) => e.stopPropagation()}>?</a></span>}>
|
|
|
|
*This method has no additional advanced call parameters.*
|
|
|
|
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
<Admonition type="caution" title="Caution" className="nocli-admonition">
|
|
<div className="addin">
|
|
<strong>NOCLI:</strong> this method is not available in CLI version
|
|
</div>
|
|
</Admonition>
|
|
|
|
|
|
```bsl title="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);
|
|
```
|
|
|
|
|
|
|
|
|
|
```json title="Result"
|
|
"AddIn.OPI_WSClient.Main"
|
|
```
|