1 Reply Latest reply on Mar 23, 2017 7:42 AM by hda RSS
    hda Newbie

    wsems can not read the propertys  when it running as a service

    hello, i have some trouble when i run wsems and lsr. hope you can help me, thank you!

     

     

     

     

    I run the wsems and lsr as service, it can connete whit thingworx for the  isConnected has changed to True. But the property can not update to thingworx, It read NULL or default in thingworx.

    Then, I capturing the packet, all property reads UNKNOWN. and some packet reads : error /scrips/MyThing/propery/ipAddress/ not found.

     

     

     

     

    sometimes some property is updated, but others didn't. but they are the same setting for pushType and so on.

     

     

    my microserver is :

    ThingWorx Websockets MicroServer, version 5.3.1.1113                           

    Copyright (c) 2013 by ThingWorx, Inc.

    thingworx is 30 days instances.

     

     

    it is very grateful if someone can help me.

      • Re: wsems can not read the propertys  when it running as a service
        hda Newbie

        my configuration file is etc/config.json and etc/config.lua, template is etc/custom/temptes/MyThingTemplate.lua

         

        I get the property in etc/custom/scripts/MyThing.lua,

        I define several variables, such as myIP, myTime in MyThing.lua

        local myIP

        local MyThime

        and then, I get the properties in the main loop, like this:

         

        while p_data.run do

             myIP = myAPI.getIP()

             myTime = myAPI.getTime()

         

        end

        log.info(p_data.name, "Exiting")

         

        and for myTime:

         

        function property_myTime(method, path, headers, query, data)

          if method ~= "GET" then return 405, "Only GET is allowed" end

          local resp = json.encode({

            value   = myTime,

            time    = os.time() * 1000,

            quality = "GOOD"

          })

          return 200, resp

        end

         

         

        it's that right???

         

         

        However, there is a problem that the operation to get attributes is time-consuming,

            myIP = myAPI.getIP()

             myTime = myAPI.getTime()

        about 1 seconds per function.

        ps: myAPI is .so file which build from c.

         

        is that any problem??

         

        I'm sorry for my bad English.