Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hello everyone,
I'm a newbie working with Thingworx platform. Currently, I have some concerns about the EMS and Lua script. I already knew about the benefit when we use the EMS to connect the remote thing. But the REST API, SDK and LUA script make my confusion:
- When I use EMS standalone, I can Read/Write data from Thingworx Platform through the REST API of EMS. So, the workflow I prefer is read data from sensor -> Use PUT request to send data to Thingworx via EMS. It is practice for me because I can use only one script (in any languages programming) to read data and send it to Thingworx. I saw some examples concern about Andruino and other microprocessors, so I think that is is a good choice to send data via REST API because they can access to Wifi but they can't program with LUA or SDK. That is why I concern about the LUA script. The LUA script is just an optional in Thingworx or it required to connect all the remote things ?
- By the way, it is similar with the REST API, I don't know exactly the benefit of SDK in this case. Could you please give me some examples to choose which method should be used to send data to Thingworx ? I have no ideal to choose which one should to be learned deeper because I come from IT and the REST API is very familiar for me. If three method are the same, I always want to use REST API.
Solved! Go to Solution.
The point of the EMS or the Agent SDK is so you can get a safe and secure bidirectional connection from your devices/systems to Thingworx over websockets.
If you are just doing REST PUT to Thingworx you don't need an agent at all.
the compiled EMS agent doesn't need LUA but LUA is included so that you can use LUA to retrieve information from your device or system to then transmit that through the EMS back to Thingworx.
Agent SDKs exist to create more integrated solutions.
What you can do is just leverage the EMS and PUT/POST information to the EMS locally on the device/system and have that be communicated securely to the Thingworx platform.
Hi PaiChung,
I saw this post "https://community.ptc.com/t5/ThingWorx-Developers/Thingworx-and-EMS/td-p/517380" and also see some lua script example in the micro service zip file . And what I found is that the lua script also use REST API call to EMS server (setProperties function in server.lua). So, that is why I think Lua scrip is just an optional at this point. I can use any languages programming I want to read data from sensor (if this language had the library to do that, as the link above, Python) and send this data to Thingworx via a REST API call (POST/PUT) to EMS. EMS shall send the data to ThingWorx Platform through Always On (Websocket). Please help me to correct it if I misunderstand.
Correct.