w3c / wot-scripting-api

Web of Things (WoT) Scripting API
http://w3c.github.io/wot-scripting-api/
Other
42 stars 28 forks source link

Consumer cleanup behavior #395

Open danielpeintner opened 2 years ago

danielpeintner commented 2 years ago

@relu91 raised concerns int a call w.r.t. cleaning up client connections

We have a problem in node-wot that CoAP clients are not being closed which causes hanging … should we add something like a destroy method to the ConsumedThing? … socket is currently not being closed. Problem is not limited to CoAP, however, also relevant for WebSockets, for example

see https://www.w3.org/2022/03/28-wot-script-minutes.html#t05

danielpeintner commented 2 years ago

@JKRhb

NAMING: stop() / free() / ? destroy() / shutdown() .. semantic issue Re-using connection?

danielpeintner commented 2 years ago

@JKRhb

@danielpeintner

relu91 commented 2 years ago

call 16/05

We can start discussing this in a PR

danielpeintner commented 2 years ago

Sorry for missing the call

  • See Generic Sensor API

Do you mean the Generic Sensor API is an argument of having start() and stop(), right?

Most of the protocols are RESTful meaning no need to setup or do some pre-processing. WebSocket for example is an exception where setting up the connection might be useful. For other protocols it might be a void operation.

Question1: Does the TD provide the necessary information. I recall discussions that we were looking for a way to initialize the connection.

Question 2: having a stop() method might also mean we require a re-start() method.. maybe.. or starting over again.

zolkis commented 2 years ago

The behavior of start() and stop() might differ based on underlying protocols. If those don't require any setup, the only thing is enabling or disabling notifications and serving Things. I think it's pretty okay design to have start() and stop(), because of

JKRhb commented 10 months ago

If I see it correctly, the result of our discussion here was to add both a start and a stop method to the ConsumedThing class, right?

danielpeintner commented 10 months ago

If I see it correctly, the result of our discussion here was to add both a start and a stop method to the ConsumedThing class, right?

I am not sure if we really should do that.

Personally, I think it is good enough what we have now

zolkis commented 10 months ago

I agree that stop() would be enough. We can add it later, when the use case becomes clear (and requested).