npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

reverb-ws-client

v1.0.6

Published

A lightweight Laravel Reverb client for React Native using the Pusher protocol.

Readme

reverb-ws-client

A lightweight WebSocket client for Laravel Reverb with support for:

  • Public channels
  • Private channels
  • Presence channels
  • Automatic reconnection
  • TypeScript support
  • Custom authorization
  • Browser and React Native support

Installation

npm install reverb-ws-client

Quick Start

import { ReverbClient } from "reverb-ws-client";

const client = new ReverbClient({
  appKey: "your-app-key",
  host: "localhost",
  port: 8080,
  scheme: "ws",
});

await client.connect();

const channel = client.channel("chat");

channel.listen("MessageSent", (data) => {
  console.log(data);
});

Configuration

import { ReverbClient } from "reverb-ws-client";

const client = new ReverbClient({
  appKey: "your-app-key",
  host: "localhost",
  port: 8080,
  scheme: "ws",
  debug: true,

  // Required for private and presence channels
  authorizer: async (channelName, socketId) => {
    const response = await fetch("http://localhost:8000/broadcasting/auth", {
      method: "POST",
      headers: {
        Authorization: `Bearer ${token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        socket_id: socketId,
        channel_name: channelName,
      }),
    });

    return response.json();
  },
});

client.connect();

Configuration Options

| Option | Type | Required | Description | | ---------- | ------------- | -------- | -------------------------------------- | | appKey | string | Yes | Laravel Reverb application key | | host | string | Yes | Reverb server host | | port | number | Yes | Reverb server port | | scheme | ws | wss | No | Connection protocol | | debug | boolean | No | Enable debug logging | | authorizer | function | No | Used for private and presence channels |

Public Channels

const channel = client.channel("chat");

channel.listen("MessageSent", (event) => {
  console.log(event);
});

Private Channels

const channel = await client.private("private-chat");

channel.listen("MessageSent", (event) => {
  console.log(event);
});

Presence Channels

const channel = await client.presence("chat-room");

channel.listen("MessageSent", (event) => {
  console.log(event);
});

Stop Listening

channel.stopListening("MessageSent");

Unsubscribe

channel.unsubscribe();

Disconnect

client.disconnect();

Laravel Reverb Example

Backend Event

use Illuminate\Broadcasting\Channel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class MessageSent implements ShouldBroadcast
{
    public function broadcastOn(): array
    {
        return [
            new Channel('chat'),
        ];
    }

    public function broadcastAs(): string
    {
        return 'MessageSent';
    }
}

Frontend Listener

const channel = client.channel("chat");

channel.listen("MessageSent", (data) => {
  console.log(data);
});

Features

  • Lightweight and dependency-free
  • Laravel Reverb compatible
  • Automatic reconnection
  • Public channels
  • Private channels
  • Presence channels
  • TypeScript support
  • React Native support
  • Custom authentication flow

License

MIT