About the WSEMS Zip File
The WSEMS ZIP file, contains a /etc folder with a config.json file that must be configured. The host, port, and application key string must be configured for your environment. The staging and updates directories (which must exist on the agent’s file system) must also be specified.
For more information on ThingWorx WebSocket-based Edge MicroServer (WSEMS), see the ThingWorx Edge/Connectivity Help Center.
The following is an example of a minimal config.json file:
{
       "ws_servers": [{
                     "host":       "192.168.1.52",
                     "port":       8080
              }],
       "appKey":     "aceb34f5-a164-4086-87c9-a453db618ca3",
       
       
       "ws_connection":     {
              "encryption": "none", 
              "verbose":    true 
       },
                           
       "logger":     {
                     "level":"TRACE",
                     "publish_directory":"./logs/",
                     "publish_level":"TRACE",
                     "max_file_storage":2000000,
                     "auto_flush":true
       },
       
       "certificates": {
           "validate" : false,
           "allow_self_signed": true
       },
       
       "file": {
           "buffer_size" : 32400,
           "virtual_dirs":[
             { "in" : "./in" }, 
             { "out": "./out" },
             { "staging": "E:/ThingWorx/RSM1.0" },
             { "updates": "E:/ThingWorx/RSM1.0/stage" }
           ],
           "staging_dir": "staging"
       }             
}
Use the config.lua file (located in /etc) to specify the scripts. The following items must be updated to match the “updates” directory specified in the config.json file:
  • <thingname>
  • sw_update_dir
The following is an example:
-------------------------------------------------------------------------------
-- Logging
-------------------------------------------------------------------------------

--
-- Set the log level for the script resource.
-- Available levels are FORCE, ERROR, WARN, INFO, DEBUG, and TRACE.
-- Default value is WARN. When running as a service it is important 
-- to set this to ERROR, WARN, or INFO.
--
scripts.log_level = "TRACE"

 
-------------------------------------------------------------------------------
-- Edge Thing Configuration
-------------------------------------------------------------------------------

--
-- Here we configure an Edge Thing to run in the scripting environment.
-- The 'file' and 'template' settings are required for all Edge Things.
-- Other parameters can be specified to change various behaviors:
--
--  * scanRate: Controls how frequently, in milliseconds, properties are 
--    evaluated and possibly pushed to the server. Milliseconds. Defaults to 
--    60000 ms.
--  * taskRate: How frequently the tasks specified in the Thing's template
--    should be executed. Defaults to 15000 ms.
--  * scanRateResolution: How long the main thread of execution for this Thing
--    pauses between iterations. Each iteration checks the scan and task rates
--    to determine if properties should be evaluated or tasks should be 
--    executed.  Must be less than the scan and task rates. Defaults to 500 ms.
--  * register: Set to false if you do not want this Edge Thing to register 
--    with the EMS. Defaults to true. In most cases this should be true.
--  * keepAliveRate: How frequently the Thing should renew its registration 
--    with the MicroServer. If the MicroServer is restarted this value controls
--    the max amount of time that may pass before the Thing is re-registered.
--    Defaults to 15000 ms.
--  * maxConcurrentPropertyUpdates: The max number of properties that will be 
--    included in a single property update call to the server. Defaults to 100.
--    This can be decreased if the overall size of the batch property pushes 
--    is larger than the EMS supports.
--  * getPropertySubscriptionsOnReconnect: If the Thing is not able to connect
--    to the MicroServer, on the next successful connection it will re-request 
--    its property subscription information if this setting is set to true. 
--    Useful if the script resource is running on a separate machine than the 
--    MicroServer.
--  * identifier: Register with the EMS and Platform using this identifier.
--  * useShapes: Turn on/off the use of DataShapes for property definitions.
--    Defaults to true.
--
scripts.AcmeThing = {
    file = "thing.lua",
    template = "example",
    sw_update_dir = "E:/ThingWorx/RSM1.2/stage"
}

 
-------------------------------------------------------------------------------
-- Example integration script
-------------------------------------------------------------------------------

--
-- See etc/custom/scripts/sample.lua for implementation details.
--

scripts.sample = {
  file = "sample.lua"
}
Once both files have been updated to suit your environment, start your MicroServer by running the wsems.exe file. You must then start the Lua extension script resource: luaScriptResource.exe
Your asset appears as connected in the ThingWorx Software Content Management application.