gamepad-io: Using game controllers, the Web Gamepad API, Electron, socket.io, and a custom module to use any game pad or controller as a Satellite surface for Companion

I started on this over 6 months ago – and am excited to release this! Last year, I was approached by a programming client who had a simple ask: “Can I use an Xbox controller with Companion?” This of course got my wheels turning, for a few reasons. 1, It’s cool. 2, It hadn’t been done before. 3, Game controllers are inexpensive, and that excited me for anyone trying to do more while spending less, like so many of us are trying to do in church tech ministry.

My first response to this client was: “I can make this – but I want to release it as an open source project for the community. You’ll effectively help to sponsor the creation of a new resource for everyone, while gaining the custom solution you need.”

They agreed and I got started. I first created a small Electron app that runs a Renderer process with a Chromium window that accesses the Web Gamepad API. Any game controller that is connected to the computer (whether wired or wireless) will show up once a button on any controller is connected.

All of this controller data is tracked and stored, and then sent via socket.io to any connected client. The app itself could be used to send this controller data to anything. In my case, I made a Companion module that listens to this socket and then the module itself emulates a Companion surface.

My client needed a lot of variables and configuration options for what they were doing. Every button and axis movement is stored as a variable in the module. And, if you enable the option to use as a surface, you can press controller buttons and it will then in turn press the assigned button in Companion! I’ve been stress testing this with my client for a few months now and am super pleased with how well it works.

Here’s a video of it in action:

The module is in the Companion betas now, and you can download the app for free from my Github repository: http://github.com/josephdadams/gamepad-io/releases

It’s open source, so if you see something that could be better, submit a pull request!

6 thoughts on “gamepad-io: Using game controllers, the Web Gamepad API, Electron, socket.io, and a custom module to use any game pad or controller as a Satellite surface for Companion”

  1. This is exactly what I was looking for! Do you know when it will be in the stable channel of Companion?

      1. And to confirm that means I can only use this at the moment if I’m running the beta instance of Companion?

          1. Hmm application is working, (Mac Mini M2) it can see my controllers and inputs (PS4 Controller). I imported the companion module as a dev module but I’m getting an error: “Connection Config Unavailable: Retry (3,2,1..Loops) No place to put in an IP address. Tried toggling module on/off, reimported it, tried running companion on another IP interface, restarted host application and computer, no dice. Any ideas?

Leave a Reply to Jacob Wilson Cancel reply

Your email address will not be published. Required fields are marked *