Proxy

TCXN CCCP Solution

Info

The TCXN CCCP is a solution for applications where a direct connection between a TCP Client and the Thing is needed.

An example of such a situation is when an external SCADA system needs to connect directly to the units that the TCXN Cloud Connect Thing is hosting.

Devices connect to a specific port and register themselves by sending their device serial followed by a carriage return.

The Control API is used to start a proxy server for a specific device on a dynamic port.

After a proxy server is started for a device, clients are allowed to connect to the proxy and communicate with the device.

Proxy setup parameters

The proxy is set up by Telenor Connexion Staff with a number of parameters that is adaptable to each customers. Tell Connexion staff if there are special requirements regarding port ranges etc. when setting up the project specific proxy server.

Proxy API

Proxy Control API:

The /on endpoint

The /on endpoint starts a proxy server to which a device and client can connect.

GET /on?serial=<device_serial>[&persistent=<true|false>][&ip_whitelist=<ip>,<ip>,...][&timeout=<sec>]

serial=<device_serial> is the serial number of the device.

persistent=<true|false> determines whether the proxy server will be persistent. If so, device and client can connect and disconnect without the proxy shutting down. Any data sent by device or client when the other party is not connected will be thrown away. A non-persistent proxy will close down as soon as one of the device or client closes the connection to the proxy, possibly disconnecting the other party if connected.

ip_whitelist=<ip>,<ip>,... determines the client addresses allowed to connect to the proxy.

timeout=&lt;sec&gt; Sets a timeout for the client connecting to the proxy, if no client connection has been made within <sec> the proxy is shut down. If a client connection is made, the timeout is cancelled and the proxy will run as normal.

It returns a HTTP status code and JSON body:

200 (OK)                    { host: &lt;proxy_host&gt;, port: &lt;proxy_port&gt; }

503 (Service Unavailable)   { message: "No available ports" }

500 (Internal Server Error) { message: &lt;error message&gt; }

The /off endpoint

The /off endpoint stops a proxy server.

GET /off?serial=&lt;device_serial&gt;

serial=&lt;device_serial&gt; is the serial number of the device.

It returns a HTTP status code and an optional JSON body:

200 (OK)

404 (Not Found)

500 (Internal Server Error) { message: &lt;error message&gt; }

The /status endpoint

The /status endpoint returns the status of a proxy server for a device.

GET /status?serial=&lt;device_serial&gt;

serial=&lt;device_serial&gt; is the serial number of the device.

It returns a HTTP status code and an optional JSON body:

200 (OK)                    { device_connected: &lt;true|false&gt;, client_connected: &lt;true|false&gt;, transferred:&lt;payload bytes transferred through proxy&gt; }

404 (Not Found)

500 (Internal Server Error) { message: &lt;error message&gt; }

Thing API

Connection to Cloud Proxy

The Thing must first connect to the project specific port of proxy.cloud.tcxn.net
The flow of when the device connects and how it is told to connect, is application specific.

Registration in Cloud Proxy

When the device has connected to the Cloud Proxy, it must introduce itself to the Proxy so that the proxy can connect it to the correct client session.
The format of this is that the Thing sends it´s serial number, followed by the return character.
The Proxy will not acknowledge this.

Example: CLD-123456\r

Proxy usage flow

First Proxy client asks for a Proxy session for a Thing

PROXY-SETUP

Second Proxy and Thing sets up their respective sockets towards proxy

PROXY-SETUP

Proxy session is now running

PROXY-STEADY STATE

Proxy client is done, wants to end session

PROXY-SETUP

Performance

The transfer time for a package end to end depends mainly on latencies in mobile network.