Introduction

Introduction#

Nestjs-pusher offers a wrapper for Nestjs to work with Pusher.js in a modular styling. There were no modules or what so ever that would bring out of the box what these modules do, starting with event chunking and decorator pattern support.

Installation#

yarn add nestjs-pusher pusher
npm install nestjs-pusher pusher

Why?#

In my daily basis I do work with Pusherjs, some people that have already worked with Laravel know its one of its main "real-time" notification provider that comes with a lot of support but Nestjs did not have any library before that could help with this so i have decided to create my own also for my projects. This library aims to help everyone that uses Pusher.js and wants to use it with Nestjs, you don't have to worry with some things that are abstracted, and the core module is easily injected and can easily scan your decorated routes.

It is very handy when you need to defer a broadcast notification to a consumer but only at the end of your http request or whenever you feel you want to. The decorators will help with the broadcast defering and you can customize its behaviour with the metadata you pass.

Nestjs-pusher might not be the right tool for everyone uses Pusher, but it sure does help in my use case and anyway that runs into the same needs.

Key Features#

  • Event chunking (Server-side only but compatible with pusher official example ) https://github.com/pusher/pusher-channels-chunking-example
  • Decorators
  • Auth by default (easy to plug in your existing applications)
  • SocketId parse from client-side and decorator to inject in routes
  • Defers the controller route result and broadcasts into a channel

Support/Contribution#

This library has been made using some of my free time, everyone is free to contribute and help improving this library It comes with features that are very useful, and I do use them in my daily basis