I wanted to share a tool that we created over at FlareBot, this tool allows for you to very easily distribute web-hooks amongst your server without having to expose multiple ports, make multiple subdomains or even have multiple places to update in case of a server move.
This is the usual scenario:
You will have a program listening for a WebHook maybe on port
4456, this will mean on that site your WebHook field is like:
126.96.36.199:4456 and the same goes for other sites but different ports. Or maybe it will be different sub-domains, for example
site-2.website.com, this means you’d still need to update the backend IPs for whenever they’re updated and obviously allow for them sub-domains to be made like that.
The case with WebHookDistributor:
You setup a single port (which you can just link a sub-domain to) and send all WebHooks over there, instead of the usual updating the IP in multiple places in cases of a server move you just update the DNS. WebHookDistributor works in a very dynamic system, there’s no hard-coding or any of that, if you want to bring up a new listener at any time go for it, if you want to shut one down maybe for an update just do so without fear of losing events! Instead of the WebHooks received just being discarded instead they will be cached so that when your client comes back online it can receive any that it missed!
site-2.example.com it can just be
webhooks.example.com/site-2 where the
webhooks subdomain points to your server port!
I recommend checking the GitHub for more info and some examples, it is still being worked on as we see more need to add things but for right now I think it’s pretty nice.
GitHub link: https://github.com/FlareBot/WebHookDistributor
Example Java Client Class: https://github.com/FlareBot/WebHookDistributor/blob/master/Client/src/main/test/Example.java
The beauty of this service as well is it all works over HTTP so you could create other client implementations in other languages! If anyone does that feel free to make a PR and add it to the README
Finally, here is a… strangely done diagram showing how it works