Tunneling with Pelion Direct Connect Client
Pelion Direct Connect Client acts as a local TCP server that accepts local TCP connections and establishes corresponding websocket connections to the Pelion Edge tunneling service through a TCP connection on the Pelion cloud.
This diagram shows Pelion Direct Connect Client has a local TCP server ready to accept any TCP-based connection locally. Pelion Direct Connect Client establishes the websocket connection to the exposed websocket API on Pelion Device Management's cloud per TCP-based connection and proxies the bytes back and forth between the local TCP connections and cloud websocket connections.
Websocket API
For details about the exposed websocket API, please see the Swagger documentation.
Configuration of parameters
Parameter | Type | Description | Example |
---|---|---|---|
listen-uri | string | Local address that Pelion Direct Connect Client is listening on. (Please note this is not related to the container service that is listening to the device.) | localhost:8181 |
cloud-uri | string | The exposed websocket API on the Pelion Device Management cloud that is ready for connections from Pelion Direct Connect Client. Check the last step for how to use this API. | wss://{PDM_CLOUD_API_ADDRESS}/v3/devices/{DEVICE_ID}/services/127.0.0.1:80/connection |
api-key | string | Access key generated from the Pelion Portal | ak_********* |
Using Pelion Direct Connect Client
-
Deploy a TCP-based container service to the gateway.
-
Build the client by running:
$ go build
-
Launch pelion-direct-connect-client locally by providing parameters -
listen-uri
,cloud-uri
andapi-key
:$ ./pelion-direct-connect-client -listen-uri=<LOCAL_ADDRESS> -cloud-uri=<CLOUD_URI> -api-key=<API_KEY>
-
Open a browser by pointing to the address with the above
listen-uri
.
Note: The browser is one of the example local clients and the choice of local client depends on the container service deployed on the gateway.