node-wot
node-wot copied to clipboard
Mqtt implementation needs improvements
I've recently worked on #456 and I had the opportunity to have a look into the current implementation of the MQTT binding. I think it can be improved in multiple points, some of which may impact also the binding specification.
- [x] Missing the ability to self-host the broker. I think that the server implementation should be able to self host the broker not only connect to an external remote node.
- [x] Missing a correct definition of the configuration parameters. For reference please have a look into the current HTTP implementation where the client has a properly defined interface in the http.ts for the config object.
- [x] Client implementation lacks the ability to connect using user and password
- [ ] Proper definition of form parameters. Now QoS and retain are not really used in the code. We need to implement a proper model in the binding document.
- [x] Unit tests are not self-contained but depend upon core libraries. I think we should just test the protocol APIs rather than the full stack in a binding package. Or if we want to test the full stack we should provide smaller tests that just focus on binding APIs.
- [x] Refactor the expose function in smaller units (but this is a problem of almost every binding).
- [x] Refactor client implementation to have the same code style of other clients (e.g., it uses
method = () => {}
instead ofpublic method(){}
)