Tunneling from the ThingWorx platform to an Edge Device can be easily done with a few preparation steps on the platform side:
For this example I'm going to keep it simple and set up an EMS (Edge MicroServer) instead of an SDK. This EMS will be on a totally separate device (an Ubuntu machine), while my ThingWorx server is on my local machine.
The next series of steps talks about configuring a VNC Server on the EMS machine and a VNC Client on the computer you are using to connect to the server. For this example I will be using packages tightvncserver, xfce4, xfce4-goodies, and vnc4server on my Ubuntu machine that hosts the EMS, and I will be using the tightvnc viewer available for download here.
I want to note that I am specifically using a 64-bit Ubuntu 14.04 LTS OS
For the machine that is being used to view the Mashup, install the tightvnc server from the link mentioned above. You should double-click the tightvnc-jviewer.jar file to run the viewer application now so it is up and ready for the Establishing a Tunnel section.
This next portion of the tutorial covers creating the Mashup that will be asked by any user who wants to remote into the Edge device.
The following section is the last part of the process where we actually establish a tunnel between the client, platform, and remote device.
This is phenomenal documentation, Meghan! Nice work!
I am having an issue with the final step (and I think I did everything right up until now). I see this error message when I try to connect to the server:
or this one when I use 127.0.0.1::16345 instead of localhost::16345:
I installed TightVNC on Windows just for local testing purposes, so hopefully that is not the issue (it should work this way, shouldn't it?)
Let me know your thoughts. Thanks!
You are connecting from your local machine I'm assuming, Windows, and what are you connecting to? Whatever you are connecting to needs the TightVNC Server installed on it, and then your local machine has the TightVNC Viewer installed on it.
Right, I am all on one host, and wondering if that is a problem. I am connecting to the EMS which is also running on localhost. TightVNC is running on localhost, also (like I can start and stop it in the Services windows application). Oh, wait do I need to connect the EMS to the VNC server in some way? I am a little confused about how this works conceptually, I suppose
You are definitely going to need at least two separate devices (one to host the EMS and one to host ThingWorx).
To explain this a bit further, in a more real world example, you will have a ThingWorx server sitting somewhere on a machine, an EMS out in the field on another device, and then your client machine (laptop). The client machine is where tightVNC Viewer is installed and the EMS device is where the tightVNC server is hosted. Traffic is routed from client machine to the ThingWorx server then to the EMS device and back again, so trying to open a tunnel from a client machine that is hosting an EMS and the ThingWorx server is not an appropriate testing scenario because you are not tunneling outside of your localhost. This is why you are seeing the connection refused.
Ah, ok. I suspected as much. Now I just need to remember who borrowed my Raspberry Pi... thanks for your help clarifying this!
Great documentation, thanks so much for your effort.
I am having an issue at Establishing a Tunnel. When I click on wsadapter.jnlp I do get the error "Unable to launch the application", but is a different error then you describe.
I have been unable to find a resolution. Do you have any ideas on what the issue could be? I am using ThingWorx version 7.1.2-b6 on Windows 7.
Greak work. But we would like to how to achieve the same with Edge SDKs like Dotnet, Java instead of EMS?
Can you share if you have any links for the same.?
In the marketplace there is also an SSH Extension, where one can use SSH from the platform, possibly together with the Terminal widget in the same extension. This works easy for connecting from the Thingworx Server to SSH servers in the same network. But do you know how to configure things to use the Terminal Widget and SSHServer Template to issue SSH commands from a mashup over a tunnel to an Edge Device ? Using the Remote Access Widget requires you to connect an SSH client like PuTTY to the listen port of the Java application launched by the Remote Access widget. But it would be very nice if we could use the SSH Extension and Terminal Widget to send SSH commands to the Edge Device from a mashup. Because if we use the built-in VNC client this also manipulates the visible UI on the Edge Device (e.g. a HMI), but with SSH we could manipulate the edge device without noticable visual effects.