Description
Hi,
I'd like to contribute to this project, as I use it in my own home system (with some self-made things, which I plan to release as free open source hardware + software as soon as I got a complete breakthrough).
I already provided a small pull request an hour ago. There are some things, which I'd like to discuss, before taking the effort.
What I noticed is for example, that the target files js/map/d.ts are transpiled/generated directly into the same location where the source files are. This makes navigation in code harder. Is this by intention? Would a PR be accepted, which puts the generated files into a bin folder (or whatever name you prefer?) instead?
Also I'd suggest to extract the SingleThing
/ MultipleThings
classes into separate files to make server.ts easier to grasp. Handlers may be extracted e.g. into a folder lib/handlers
if accepted.
I noticed that it is rather hard to integrate things with any kind of subscriber pattern. Those things would:
- only notify about events when subscribed
- as a special case of event: only notify about property changes when there is a subscriber - if they support this kind of notification at all -> read back from the thing itself in case of a get is often required.
While the latter is an implementation thing of the webthings-node, for which I'd like to file a PR, which introduces aget
callback function returning a promise onValue
, the first one would need an extension on the WebThings specification: There is noaddEventSubscription
on the REST API (adding this would imply a session handling of course). The event description should contain an information on whether the event requires a subscription or if it just works. Also in general I am missing aremoveEventSubscription
in the WebSocket API. Where would be the best place for suggestions towards the WebThings specification?
My "workaround" to integrate those devices will be, that my webthings bridge subscribes on all events when adding a thing, which however may overcrowd the limited bandwidth of the local CAN bus in cases where there are many things with many events. Another workaround would be to add an additional property for each event to be able to turn it on/off.
I know that's much information. I am willing to split this ticket up and rename it and also provide PRs depending on your feedback.
Thank you, Michael