ThingWorx WebSocket-based Edge MicroServer (WS EMS) and Lua Script Resource (LSR) > Additional Configuration of WS EMS > Auto-bound Gateways
Auto-bound Gateways
When you configure the auto_bind group of a WS EMS, it is very important to note the difference between the settings, "gateway":true and "gateway":false. When used with a valid "name" property, either value results in the WS EMS attempting to bind the thing with the ThingWorx platform. In addition, either value allows the WS EMS to respond to file transfer and tunnel services that are related to the automatically bound things. However, the similarities end here.
An auto-bound gateway can be bound to a ThingWorx platform instance ephemerally if there is no thing to bind with on the instance. Ephemeral binding is a temporary association between a platform instance and the WS EMS that lasts only until the WS EMS unbinds the gateway. In general, ephemeral things are created on a ThingWorx platform when no remote things with a matching thing name exist on it.
When the WS EMS is attempting to bind a gateway, a thing is automatically created on the ThingWorx platform, using the EMSGateway template. The ThingWorx platform binds the auto-bound gateway with this ephemeral thing. This thing is accessible only through the WS EMS REST Web Service. Once the WS EMS unbinds the gateway, the ephemeral thing is deleted
If you do not want the automatically bound gateway to be ephemeral, you can create a thing for it and choose the EMSGateway thing template in ThingWorx Composer. If you do not choose this template for the thing, the platform does not bind the gateway with your thing.
When used both normally and ephemerally, the EMSGateway template provides some services that are specific to gateways. These services are not accessible to things that are created with the RemoteThing (and derivatives) thing templates. Refer to the EMSGateway Class Documentation for more details. For a list of REST Web Services that provide some of the services of the EMSGateway class, refer to Using Services with a WS EMS
The devices for which a WS EMS acts as a gateway can be set up to identify themselves to the WS EMS when they initialize and connect to it. Alternatively, when these devices are well known, you may want to define them explicitly in the WS EMS configuration. For examples of these two types of gateway configurations for a WS EMS, see the section, Example Configurations.
A thing that is automatically bound but is not a gateway has the following requirements:
For the WS EMS to respond to messages that are related to properties, services, or events for a non-gateway, automatically bound thing, a LuaScriptResource must exist. Custom Lua scripts must exist within the LSR to provide the capabilities to handle services, properties, and events.
For the non-gateway thing to bind successfully, you must first create a corresponding thing on ThingWorx platform, using the RemoteThing thing template (or any template derived from RemoteThing, such as RemoteThingWithFileTransfer).
The most common use of this type of automatically bound thing is to bind a simple thing that can handle file transfer and tunnel services but does not need any custom services, properties, or events.
For an example of a non-gateway configuration for WS EMS, refer to the section, Example Configurations.