You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documents/Secure_Tunnel_Userguide.md
+19-2Lines changed: 19 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,14 @@ When a WebSocket upgrade request fails to connect, this callback will return an
94
94
When the WebSocket connection shuts down, this callback will be invoked.
95
95
96
96
### OnSendMessageComplete
97
-
When a message has been completely written to the socket, this callback will be invoked.
97
+
98
+
This callback is invoked when either a message has been completely written to the socket or an error occured.
99
+
The callback is invoked for the following operations:
100
+
- SendMessage
101
+
- SendStreamStart
102
+
- SendConnectionStart
103
+
104
+
See [Send Message](#send-message) for additional details.
98
105
99
106
### OnMessageReceived
100
107
When a message is received on an open Secure Tunnel stream, this callback will return the message.
@@ -208,9 +215,18 @@ Service Ids can be added to outbound Messages as shown below in the Send Message
208
215
Connection Ids can be added to outbound Messages as shown below in the Send Message example. If there is an active stream currently open using the combination of the Service Id and Connection Id, the message will be sent. If a Connection Id is not set on an outbound message, a Connecion Id of 1 is assumed and applied to the Message. When additional streams are activated, the `OnConnectionStarted` callback is invoked and returns a `ConnectionStartedEventData` which can be parsed to determine the Connection Id of the newly activated stream. A Connection Id will also be present in the `StreamStartedEventData` that is returned when the `OnStreamStarted` callback is invoked.
209
216
210
217
# Send Message
211
-
The `SendMessage()` operation takes a description of the Message you wish to send and returns a success/failure in the synchronous logic that kicks off the `SendMessage()` operation. When the message is fully written to the socket, the `OnSendDataComplete` callback will be invoked.
218
+
219
+
The `SendMessage()` operation takes a description of the Message you wish to send and enques the message for sending it asynchronously to the destination. The call returns a success/failure in the synchronous logic that kicks off the asynchronous operation. However, since the main validation actions are performed asynchronously, the user code should setup the `OnSendMessageComplete` callback for catching errors.
212
220
213
221
```cpp
222
+
builder.WithOnSendMessageComplete(
223
+
[&](SecureTunnel *secureTunnel, int errorCode, const SendMessageCompleteEventData &eventData) {
224
+
if (errorCode)
225
+
{
226
+
fprintf(stdout, "Send Message failed with error code %d(%s)\n", errorCode, ErrorDebugString(errorCode));
* You MUST NOT perform blocking operations on any callback, or you will cause a deadlock.
235
252
* If you do not provide a Client Token during creation of the Secure Tunnel, one will be automatically generated for you to use in reconnections. This token is not saved outside of the current Secure Tunnel Client. If the Client is destroyed, the original access tokens must be rotated to connect to the secure tunnel again. Information on rotating tokens can be found here: https://docs.aws.amazon.com/iot/latest/developerguide/iot-secure-tunneling-troubleshooting.html
Copy file name to clipboardExpand all lines: samples/secure_tunneling/secure_tunnel/README.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -20,14 +20,15 @@ The sample will create a Secure Tunnel connection and remain connected in `DESTI
20
20
21
21
### Source Mode
22
22
23
-
While the focus of the Secure Tunnel Client for the IoT Device SDK is to connect with Secure Tunnels in `DESTINATION MODE` we also support connecting in `SOURCE MODE`. The token file should be the Source Token in this instance and you must add the `--localProxyModeSource` flag:
23
+
While the focus of the Secure Tunnel Client for the IoT Device SDK is to connect with Secure Tunnels in `DESTINATION MODE` we also support connecting in `SOURCE MODE`. The token file should be the Source Token in this instance and you must add the `--local_proxy_mode_source` flag:
24
24
25
25
```sh
26
-
./secure-tunnel --signing_region <signing_region> --access_token_file <path to source access token> --localProxyModeSource
26
+
./secure-tunnel --signing_region <signing_region> --access_token_file <path to source access token> --local_proxy_mode_source
27
27
```
28
28
29
-
Then two samples will then connect to each other through the AWS Secure Tunnel endpoint and establish a stream through which data can be transmitted in either direction.
29
+
Then two samples will connect to each other through the AWS Secure Tunnel endpoint and establish a stream through which data can be transmitted in either direction.
30
30
The sample will create a Secure Tunnel connection in `SOURCE MODE` and will open a stream using an available `Service Id`. It will then send n messages on the opened stream. It will then create a new simultaneous TCP connection on the stream and send an additional n messages on the new TCP connection. It will then exit.
31
31
32
32
### Proxy
33
+
33
34
Note that a proxy server may be used via the `--proxy_host` and `--proxy_port` argument. If the proxy server requires a user name and password to connect, you can use `--proxy_user_name` and `--proxy_password` to in the sample to pass the required data to the sample.
0 commit comments