Re: how does thingworx subscribe to an event on external public server?
Hello, there is no OOTB mechanism for this in ThingWorx. You will have to develop a custom extension. You can then use threading and listeners as they are implemented in whichever language you choose. Here is a KCS article on the Eclipse plugin.
You can find an overview on Extension development in the Help Center. You could also check out the MQTT extension in the ThingWorx Marketplace, but note that there is no support for this (so if you run into bugs or issues getting that configured, you will have to post here on the Developer Community to get help as opposed to opening a case on support.ptc.com).
You could also just download the MQTT extension, look at it's source code, and then use that as an example to build your own using the SDK.