Pusher with Redux

You might have heard about a wonderful service called Pusher. It is a service which allows you to make live updates without handling infrastructure on your own.

When I wanted to add it into my React - Redux application I was surprised to find out that there are no libraries which help you. So I decided to write my own. I called it pusher-redux.

I think it turned out to have a very convenient API you can call anywhere from your Redux application. Let me explain how to use it below.

First you need to configure Pusher in your app.js:

Then you need to subscribe to it in your component:

This is how you handle it in your reducer

Pusher-redux dispatches actions of the following format, you can find data you send in action.data:


Popular posts from this blog

Faster Google Maps load times

Ruby on Rails optimization techniques

Next.js: restrict pages to authenticated users