A few months ago we announced a new open-source tool called Gateway Hub, to help you deal with interactive remote access to YoctoHubs behind a NAT firewall. This free tool is now becoming even more useful, with the addition of support for forwarding HTTP, MQTT and WebSocket callbacks to third-party services.
In case you need some background, you will find more explanations on the idea behind our Gateway Hub in the previous article covering this topic.
The main drawback of the initial version was the fact that it did require to configure the only one available outgoing callback in a YoctoHub to connect to the gateway hub in order to enable remote control. That was useful to remotely monitor an application running within a local network, but it did not allow to remotely monitor a YoctoHub that needs to run HTTP callbacks to a third-party service such as EmonCMS, Valarm or a MQTT or YoctoCloud server.
Limitation of the initial release
The new version allows to configure several outgoing callbacks directly within the Gateway Hub. The YoctoHub stil uses a single callback, but the Gateway Hub can now forward it to several locations, in addition to accepting incoming connections:
The Gateway Hub can now dispatch outgoing callback connections
All types of outgoing callback connections supported by YoctoHubs and by the VirtualHub are supported by the Gateway Hub. The configuration page is unsurprisingly very similar to the one you can find there, including a Test button to diagnose the outgoing callback connection.
The Gateway hub outgoing callback configuration page
If you configure multiple outgoing callbacks, they don't need to share the same schedule: each of them can run at its own frequency. The only constraint is that, to maintain consistency, only one of them will run at a time. So if you configure multiple callbacks at the exact same schedule, one will be triggered before the other, and the second will only start when the connection to the first one is completed. In particular, this implies that when using an outgoing websocket callback, you should ensure that the callback server releases the connection as soon as its job is done, to enable the next outgoing callback to be started on the Gateway hub.
For the same reason, if you open an interactive session to the YoctoHub or connect an external API application via the Gateway hub, all outgoing callbacks will be paused while the client session is active. As soon the client session is disconnected, outgoing callbacks will resume according to their schedule.
You will find this new version of our Gateway hub, including full source code, on GitHub as usual. Feel free to improve it or customize it according to your needs, or report any problem to email@example.com.