eclipse-thingweb / eclipse-thingweb/node-wot

Can't invoke an action with the current MQTT implementation

Open
#463 8 comments 0 reactions 0 assignees View on GitHub
binding-mqtt
Dominant language
TypeScript
Stars
192
Forks
100
Avg merge
3d 2h
Merged PRs (30d)
6

Description

As well described by @alvarogar23 in https://github.com/eclipse/thingweb.node-wot/pull/456#issuecomment-894864670, it seems that with the current implementation is not possible to invoke actions using MQTT. In the comment above he pinpointed a particular line that is causing the issue: `var topic = requestUri.pathname.slice(1)`

Checking the [git blame](https://github.com/eclipse/thingweb.node-wot/blame/1a53afca80fa6356368e8f1b234f5ef7a620e3df/packages/binding-mqtt/src/mqtt-client.ts#L90) it seems that it was updated by @JKRhb. I vaguely remember the reasons why we applied these changes, maybe @JKRhb would you like to refresh my memory? was it something about how we handle topics, right?

For reference here's one of @alvarogar23's TDs:
```js
{
"@context": "https://www.w3.org/2019/wot/td/v1",
"title": "AireAcondicionado",
"id": "urn:dev:wot:mqtts:AireAcondicionado",
"actions" : {
"OnOff": {
"forms": [
{"href": "mqtts://localhost:8443/AireAcondicionado/actions/OnOff"}
]
},
"incrementar": {
"forms": [
{"href": "mqtts://localhost:8443/AireAcondicionado/actions/incrementar"}
]
},
"decrementar": {
"forms": [
{"href": "mqtts://localhost:8443/AireAcondicionado/actions/decrementar"}
]
},
"leerTemperatura": {
"forms": [
{"href": "mqtts://localhost:8443/AireAcondicionado/actions/leerTemperatura"}
]
}
},
"events": {
"estadoTemperatura": {
"type": "integer",
"forms": [
{"href": "mqtts://localhost:8443/AireAcondicionado/events/estadoTemperatura"}
]
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.