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

@epklabs/pushpop

v2.0.1

Published

a front end client for PushPop written in typescript

Downloads

167

Readme

PushPop

jsDocs.io

A simple and friendly WebSocket solution for real-time messaging.
Use the Go server and hub to handle WebSocket communication with clients, and pair it with the TypeScript/JavaScript client library to easily integrate into your frontend applications.

Features

  • Go Server Binary: Run a ready-to-use WebSocket server that provides a /ws route for connections and a /trigger route for sending messages.
  • TypeScript Client: Connect, subscribe to channels, and bind event handlers in your frontend or Node.js environment.
  • Go Library: Import the hub and client logic into your own Go application for maximum customization.

Quick Start

Running the Go Server via Docker

docker run -p 8945:8945 ghcr.io/biohackerellie/pushpop:latest

This exposes the server on http://localhost:8945 with:

  • GET /ws for WebSocket connections
  • POST /trigger for sending messages

Using the TypeScript Client

Install the client from npm:

npm install @epklabs/pushpop

Server Side Trigger

import {SocketServer} from '@epklabs/pushpop'

const socketServer = new SocketServer({
    host: localhost
    port: 8945
    useTLS: false // true if using HTTPS
})

async function sendMessage() {
    await socketServer.trigger({
        channel: 'my-channel',
        event: 'incoming-message',
        payload: JSON.stringify({message: 'Hello, world!'})
    })
}

Client Side Socket Listener

//src/lib/socket.ts
import {SocketClient} from '@epklabs/pushpop'

// Initialize as a singleton to prevent multiple connections

let socketClient: SocketClient | null = null

export function getSocketClient() {
    if (!socketClient) {
        socketClient = new SocketClient({
            host: 'localhost',
            port: 8945,
            useTLS: false // true if using wss (WebSocket Secure)
        })
    }
    return socketClient
}

//src/app/messages.tsx

import * as React from 'react'
import {getSocketClient} from '../lib/socket'

const Messages: React.FC = () => {
    const [messages, setMessages] = React.useState<string[]>([])
    React.useEffect(() => {
        const socketClient = getSocketClient()

        // PushPop uses channels to group messages together  
        socketClient.subscribe('my-channel')
        // The client requires a handler function to process incoming messages
        const handler = (message: string) => {
            setMessages((prev) => [message, ...prev])
        }

        // Bind the handler to the channel and event
        client.bind('my-channel', 'incoming-message', handler)
        return () => {
            socketClient.unsubscribe('my-channel')
            socketClient.unbind('my-channel', 'incoming-message', handler)
        }
    }, [])
    return (
        <div>
            {messages.map((message, index) => (
                <div key={index}>{message}</div>
            ))}
        </div>
    )
}

Integrating the Go Libary in Your Application

If you prefer to integrate the hub directly into your own Go server:

import(
    "github.com/epklabs/pushpop"
    "net/http"
)

func main() {
    h := pushpop.NewHub()
    go h.Run()

    // pushpop requires only 2 routes: /ws for WebSocket connections and /trigger for sending messages
    http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) {
        pushpop.ServeWs(h, w, r)
    })
    http.HandleFunc("/trigger", pushpop.HandleTrigger(h))

    http.ListenAndServe(":8945", nil)

}

You can then trigger messages by using h.Trigger(message) directly in your code. That's it! With PushPop, you have a lightweight real-time messaging system ready to deploy in Docker, integrate in your backend, or connect to from your frontend. Feel free to open an issue or contribute if you have ideas or improvements!