WebThing Properties

Issue #159 resolved
Turgut Guneysu created an issue

I am not sure what is the correct operation for the PROPERTIES handling for the WebThing server.

Here is what happens:

  • WebThing defined with a property var, eg: onoff as binary.
  • Additional program vars are declared, eg: var1 and var2
  • Inquiry: http://IP/properties lists the webThing property onoff only.
  • However, inquiry http://IP/property/var1 or http://IP/property/var2 will actually display the values for the program variables, that are NOT part of the webThing.

Is that the way it is supposed to be?

Comments (4)

  1. John Maloney repo owner

    Yep, that’s the intended behavior. In fact, the IDE’s WebThing Server doesn’t use the Thing Definition at all; it simply make all the global variables in the project available as properties.

    The IDE WebThing Server was added to allow Snap! to interact with non-WiFi boards via the IDE. At the time, it seemed like a good idea to be somewhat compatible with the WebThing gateway protocol but now I’m wondering if both the name “WebThing Server” and the use of the WebThing gateway protocol is merely confusing. We may want to reconsider that… (@Bernat Romagosa what do you think?)

  2. Bernat Romagosa

    That is the intended behavior, yes. We decided that, if you’re using the IDE as a WebThing server, all vars would be visible from the outside.

    As John says, the confusion (you’re not the first one to be confused) comes from having two different Web Thing servers in there. I think we may want to either rename the IDE WebThing server to make it clear that the IDE is acting as a server, or maybe even ditch that WebThing server implementation and do something simpler, like the old Scratch HTTP protocol.

  3. John Maloney repo owner

    v1.0.10 renames the server built into the IDE to “HTTP” server and it no longer uses the WebThing protocol (which was confusing). It still supports interactions with Snap! but since the protocol has changed the URL’s in the Snap! code will need to be changed.

  4. Log in to comment