WebThingsIO / thing-url-adapter

Proxy adapter for Web Thing API endpoints
Mozilla Public License 2.0
22 stars 18 forks source link

removed URL things aren't really removed #35

Closed twobraids closed 6 years ago

twobraids commented 6 years ago

If I add a Web Thing to the Things Gateway, observe that it works, then REMOVE the device, it appears the device is still connected. I rebooted a Things Gateway after the aforementioned removal then noticed that the Gateway was still updating a device that was supposedly no longer there: no-removal

This ends up being really inconvenient for developing URL based things. If testing a second URL based thing with an incompatible set of properties, but on the same machine with the same IP, the second thing is flooded with GET requests that it cannot handle resulting in hundreds of 404 responses per second:

too-many-404s

mrstegeman commented 6 years ago

The adapter was built to function this way. Upon starting up, it will discover any web things on the network via mDNS/Bluetooth/configured URLs, and open up a websocket connection (if available) or poll the device.

It has to keep track of all devices because there is a fundamental disconnect between what things the gateway knows about and what the adapter knows about. The gateway never tells the adapter what things the user has added, so as far as the adapter knows, every "thing" is necessary.

If you're developing multiple devices, a simple fix would be to run them on different ports. The adapter will then see them as distinct things.