How to > Configure Services for Remote Things
Configure Services for Remote Things
There are two types of services for Remote Things, as follows:
Local (JavaScript) - JavaScript business logic executing on the server.
Remote - a direct call to a remote service on a Remote Thing (such as a custom-defined Lua script).
Remote Services and Binding
When you define a remote service, you are defining the metadata for the service so that it can be properly consumed from the server. The definition includes the service name at the server, the description, remote service name, and the inputs and outputs of the service. This will bind the service to the remote service, and the remote service is executed when the service runs. From a Mashup or REST Web Service perspective, it will appear the same as a local service.
When the WSEMS opens a connection to a ThingWorx Platform, it goes through a three step process:
1. Initiation: This establishes the physical WebSocket connection and prepares it to handle inbound and outbound messages.
2. Authentication: The EMS can authenticate using an application key. All communication that is passed over the connection from the EMS to the ThingWorx Platform will run under the security context of this application key. After authentication is complete applications can use the REST interface of EMS to interact with the ThingWorx Platform.
3. Binding: After authentication, Remote Things on the ThingWorx Platform can bind to the connection of the EMS. Binding is the process that notifies the platform that a particular Remote Thing is associated with an established connection. After a Thing is bound to a connection, the platform will indicate a change in the value of its isConnected property to true and update its lastConnection property. The platform can then send outbound requests to Thing.
You can also directly browse and bind to remote services if the Remote Thing is running and is connected. Click Browse Remote Services to view the services that are currently defined for the Remote Thing. You can then add them to the local service definitions through the drag and drop interface (similar to how you bind remote data properties).
The process of registering a Thing with the EMS also causes the Thing to bind. The de-registering of a Thing causes it to unbind.
Was this helpful?