Ask HN: What options are there to send an HTTP request with a hardware button?

1 points by LecroJS ↗ HN
My friend has is a small twitch streamer and wants to press a real life button that would clip his last 30-60 seconds of his stream. While it’d be trivial to write a serverless function that does this, I’d like the request to be fired from something he can have on his desk vs something like a chat command. Also if anyone has insight on using a Cloudflare worker on the edge vs a lambda/google cloud function, I’d be curious to hear which is more appropriate + cheaper for this kind of thing. Thanks!

4 comments

[ 3.0 ms ] story [ 23.5 ms ] thread
You can buy a tiny ESP32 microcontroller with built-in WiFi for extremely cheap. (So cheap, in fact, that a friend who bought me some microcontroller stuff as a gift accidentally bought a pack of 3 and thought it was the price of only 1.) A little button switch is fractions of a penny (though you'll likely have to buy a pack of many at a time). Then the code to trigger an HTTP request on a button press is a simple modification of the example HTTP client code that comes with the Arduino IDE.

So... yeah, that's the cheapest route in all likelihood. As in, you can do it all for about 3 to 5 dollars.

My guess is that the friend wants a nice button, like the one in the America Got Talent. Bonus points if it can be relocated in the desk, so perhaps add a battery and a suction cup, and a led and buzzer to confirm.
The button can be put into any case as desired, of course; it's just a switch. Not sure about the buzzer; those can get annoying. But if the HTTP request gets proxied through a little server on the friend's machine, then the server can play a nicer confirmation sound, add notifications, etc. as needed.

But yeah, if they want full wireless, a USB battery pack will do the trick.

well, what is stopping him of running a service that listens globally for a short key. The f1-12 buttons are rather underutilized nowadays. another option is the button of many keyboards to open system apps, browser included. Add a page that sends a request on loading as a home page and you have it.