Hi, In the last platform meeting <https://docs.google.com/document/d/1yo1AtuozukgfkZwzO745LdEsB1fdZrEWoIYr8F9eydo/edit?usp=sharing> we talked about kicking off the implementation of some of the key components of the platform, one of which is the WoT gateway implementation. As HomeWeb will initially be the main (only) consumer of this component, I wanted to make a suggestion about its implementation.
We already have the fxbox <https://github.com/fxbox> source code to use as a starting point, but before we just go ahead and fork all those repositories under http://github.com/moziot/ (the new home of the platform source code?) I'd like to suggest that we use the right tools for the right jobs: - Protocol adaptors - Rust - WoT API - NodeJS Reasons for using Rust for Protocol Adaptors: - Protocol adaptors (or whatever we end up calling them) are essentially hardware drivers that talk to an underlying hardware component (e.g. a ZigBee/ZWave/Bluetooth radio over a UART connection). This is exactly the type of systems programming use cases that Rust was designed for. - This low level work is particularly performance and timing sensitive and these requirements justify the overhead of using/learning and cross-compiling a low level language. - Rust is a modern and safe programming language which happens to be maintained by Mozilla, which means we can add features that are missing and improve it where necessary (we already added support for a new ARM chipset on the HomeWeb project). Reasons for using Node for WoT APIs: - NodeJS is now a very popular language for server side web development and has a huge existing community and collection of modules to draw from. Using NodeJS will help attract community contribution from web developers who can easily add their own modules when hacking on the project. - By comparison Rust is still relatively immature as a language for web development as you can read about here <http://www.arewewebyet.org/>. It's likely that our platform will need to interact with a large range of existing software and services, especially once third parties start to use it for their own projects. Rust may hold us back here while we wait for it to mature. - SensorWeb already started implementing the SensorThings API in NodeJS. I'd suggest we will eventually want to share code between the cloud and gateway WoT API <https://moziot.github.io/wot/> implementations. Using Rust for low level components and NodeJS for the WoT API seems to me like a good compromise and has a parallel in Gecko where we use both C++/Rust and JavaScript for different jobs. However, using two separate languages comes at a cost (both cognitive and complexity-wise). I personally have zero experience of writing Rust and while I know it's possible <https://blog.risingstack.com/how-to-use-rust-with-node-when-performance-matters/> to call Rust components from NodeJS I've never actually done it. I'm interested to hear other peoples' views on this (without descending into needless bikeshedding or a holy war!), particularly if anyone has experience of using these two languages together. How feasible is this? Ben _______________________________________________ dev-platform mailing list [email protected] https://lists.mozilla.org/listinfo/dev-platform

