New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@schorts/pusher-subscription

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@schorts/pusher-subscription

A lightweight, type-safe wrapper around Pusher JS for subscribing to real-time events in frontend applications. Implements the `Subscription` interface from `@schorts/shared-kernel`, enabling clean, modular integration with your pub-sub architecture.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

📡 @schorts/pusher-subscription

A lightweight, type-safe wrapper around Pusher JS for subscribing to real-time events in frontend applications. Implements the Subscription interface from @schorts/shared-kernel, enabling clean, modular integration with your pub-sub architecture.

🚀 Installation

npm install @schorts/pusher-subscription

🧱 Usage

1. Instantiate with a configured Pusher client

import { Pusher, PusherSubscription } from '@schorts/pusher-subscription';

const pusher = new Pusher('YOUR_APP_KEY', {
  cluster: 'YOUR_APP_CLUSTER',
  authEndpoint: '/pusher/auth',
  auth: {
    headers: {
      Authorization: `Bearer ${yourAccessToken}`,
    },
  },
});

const subscription = new PusherSubscription(pusher);

2. Connect and subscribe to events

subscription.connect();

subscription.subscribe('private-WAITER_KITCHEN_abc123', 'order_ready', (data) => {
  console.log('Order ready:', data);
});

3. Unsubscribe and disconnect

subscription.unsubscribe('private-WAITER_KITCHEN_abc123');
subscription.disconnect();

🧩 Interface

This class implements the Subscription interface from @schorts/shared-kernel.

🧠 Why Use This

  • ✅ Type-safe and framework-agnostic
  • ✅ Clean separation of subscription logic from transport
  • ✅ Easy to swap for other clients (e.g. Socket.IO, Ably)
  • ✅ Ideal for frontend apps using modular pub-sub architecture

📜 License

LGPL

Keywords

pub-sub

FAQs

Package last updated on 17 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts