So I had 30 minutes before I had to board my 11 hours flight from Tokyo to Copenhagen. I had to work on a new websocket based functionality that I was building at the moment that was using Pusher. Not being able to access the internet and Pusher’s servers would make it difficult to work on this new feature. So I started to look into if Pusher had a local development server available so that I could use it offline.
After a couple of quick google searches, I found that there is a project called pusher-fake and that someone built a Dockerfile for this project. It is not released or maintained by Pusher themselves but it seems to have all the functionality which is just what I was looking for.
The backend PHP script sends messages to the local Pusher server which then broadcasts it to all the frontend clients that are connected to the Pusher local dev server. Every time the frontend client receives a message it changes the background color and should look something like this.
To run the demo application yourself simply follow these 4 steps:
That’s it for this time, setting up a local dev Pusher server is great if you are on a limited plan and do not want to waste requests on your Pusher account while developing applications on your local machine. It’s also useful if you like me need offline support for your application that is using Pusher.
Until next time, have a good one!
Don’t forget to check out the full repository here: