1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2026-05-18 09:51:28 +02:00
Files
OpenIntegrations/docs/en/md/GRPC/Streaming/Send-message.mdx
T
Vitaly the Alpaca (bot) a67e644f8c Main build (Jenkins)
2026-04-29 16:58:20 +03:00

107 lines
3.1 KiB
Plaintext
Vendored

---
sidebar_position: 4
sidebar_class_name: doc-no-cli
description: Send message and other functions to work with GRPC 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, GRPC]
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Admonition from '@theme/Admonition';
# Send message
Sends the next message to the client or bidirectional stream
<Tabs>
<TabItem value="params" label="Parameters" default>
`Function SendMessage(Val Connection, Val StreamID, Val Request) Export`
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| Connection | - | Arbitrary | &#x2714; | Connection object |
| StreamID | - | String | &#x2714; | Stream Identifier |
| Request | - | Structure Of KeyAndValue | &#x2714; | Request data for sending |
<div className="return-value-note">
<div className="return-value-note__title">Returns</div>
<div className="return-value-note__value">
Map Of KeyAndValue - Processing result
</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 = "https://grpcb.in:9001";
Proto1 = "https://hut.openintegrations.dev/test_data/grpcbin_with_import.proto"; // String, path to file or URL
Proto2 = "https://hut.openintegrations.dev/test_data/mt.proto"; // String, path to file or URL
Scheme = New Map;
Scheme.Insert("main.proto" , Proto1); // Primary
Scheme.Insert("my_types.proto", Proto2); // For import in primary
Parameters = OPI_GRPC.GetConnectionParameters(Address, Scheme);
Tls = OPI_GRPC.GetTlsSettings(True);
Service = "grpcbin.GRPCBin";
Method = "DummyClientStream";
Connection = OPI_GRPC.CreateConnection(Parameters, Tls);
If Not OPI_GRPC.IsConnector(Connection) Then
Raise Connection["error"];
EndIf;
StingsArray = New Array;
StingsArray.Add("one");
StingsArray.Add("two");
StingsArray.Add("three");
Data = New Map;
Data.Insert("f_string" , "Test message");
Data.Insert("f_int32" , 123);
Data.Insert("f_bool" , True);
Data.Insert("f_strings", StingsArray);
Data.Insert("f_sub" , New Structure("f_string", "Nested value"));
Result = OPI_GRPC.InitializeClientStream(Connection, Service, Method);
If Not Result["result"] Then
Raise Result["error"];
Else
StreamID = Result["streamId"];
EndIf;
Result = OPI_GRPC.SendMessage(Connection, StreamID, Data); // <---
Closing = OPI_GRPC.CloseStream(Connection, StreamID);
```
```json title="Result"
{
"result": true
}
```