Closed egekorkan closed 4 years ago
3.Also, there is no name displayed on the page/tab. Similarly, the hands-on page displays
thingweb-thingweb
. Could you take a look at it @danielpeintner ?
https://github.com/eclipse/thingweb.website/commit/33eb9f2c4f5d72c02c5f78e7b4165f76993d2273 fixes the issue
@egekorkan Thank you very much for your feedback!
I couldn't really understand this point. If there is an event you usually also want to subscribe to that particular event, don't you? Otherwise, nothing will happen when the event is emitted, which seems quite silly for me. So, the code shows how to do it. I know that I could simply invoke the notify
function when there are no sufficient resources, but the idea was to show how events can be used in that case. Additionally, instead of just notifying, the event handler (or listener, whatever you call it) can be much more sophisticated and it's just simplified for the sake of the example.
I am aware of the readallproperties
method but this was done intentionally. The idea was to show the usage of uriVariables
with Property Affordances, and, as we have discussed in Telegram, this usually involves having another property for the same data since you cannot read/write to the same property within your own read/write handler.
About the second point, all good!
About the first one:
You subscribe to an event as the Consumer and not really as the Exposed Thing itself. Once you call the emit function, the event is sent to its subscribers on all protocols. What is very important to show is that there is no Event Handler in the Exposed Thing, you do not handle events, you emit them.
I have handlers in both client and server Thing. So, you suggest removing the server part and leaving it only inside the client?
That is what I would suggest to not give the wrong impression. You can however say that such a behavior is possible.
I will resolve this as soon as the PRs for the coffee machine + oAuth will be merged in order to avoid merge conflicts. I hope it is not asap, @egekorkan?
Yeah it's not super urgent but should not how we teach node-wot for sure
@egekorkan Please find out these two PRs closing this issue: https://github.com/eclipse/thingweb.node-wot/pull/248 https://github.com/eclipse/thingweb.website/pull/20
Issue can be closed after the merge of the PR linked above
@fatadel Your coffee machine tutorial has some misleading parts.
thing.subscribeEvent('outOfResource', (data) => {
// Notify an "admin" when the event is emitted
// (the notify function here simply logs a message to the console) notify('admin@coffeeMachine.com',
outOfResource event: ${data}
);});