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

hapore-ws

v0.0.6

Published

A simple connector to use WebSocket API from Hapore services

Readme

hapore-ws

hapore-ws es un cliente TypeScript/Node.js para interactuar con la API WebSocket de los servicios de Hapore.
Permite autenticación, consulta de eventos, gestión de canales y clientes, y envío de mensajes broadcast de manera sencilla.


Instalación

Instale desde npm:

npm install hapore-ws

Si está desarrollando localmente:

npm install ../path/to/hapore-ws

Requisitos de entorno

Antes de usar el cliente, asegúrese de definir las siguientes variables de entorno:

API_WEBSOCKET_DOMAIN=https://api.hapore.com
API_WEBSOCKET_BASE_PATH=/v1
[email protected]
API_WEBSOCKET_PASSWORD=miPassword
API_WEBSOCKET_KEY=clave_api

Uso

Importar el cliente

import { HaporeWs } from 'hapore-ws';

Autenticación y token

// Obtener token mediante login
const loginResp = await HaporeWs.login();
HaporeWs.setToken(loginResp.token);
// O usar un token almacenado previamente
HaporeWs.setToken(tokenExistente);

Consultar canales

const channels = await HaporeWs.getChannels();
console.log(channels); // ['channel1', 'channel2', ...]

Consultar eventos de un canal

const events = await HaporeWs.getEvents({ channel: 'channel1' });
console.log(events);

Consultar clientes

const allClients = await HaporeWs.getClients();
const clientsInChannel = await HaporeWs.getClientsByChannel({ channel: 'channel1' });

Enviar mensajes broadcast

const broadcastResp = await HaporeWs.broadcast({
  channel: 'channel1',
  message: 'Hola a todos',
  id: '123',
  sender: 'admin'
});
console.log(broadcastResp);

Métodos disponibles

| Método | Descripción | Retorno | | --------------------------------------------- | ------------------------------------------------------- | ---------------------------- | | login() | Realiza login con usuario/contraseña y obtiene un token | Promise<LoginResponse> | | setToken(token: string) | Inyecta un token manualmente | void | | getChannels() | Obtiene todos los canales disponibles | Promise<string[]> | | getEvents({ channel }) | Obtiene los eventos de un canal | Promise<Event[]> | | getClients() | Obtiene todos los clientes | Promise<string[]> | | getClientsByChannel({ channel }) | Obtiene los clientes de un canal específico | Promise<string[]> | | broadcast({ channel, message, id, sender }) | Envía un mensaje broadcast a un canal | Promise<BroadcastResponse> |

Notas

  • El cliente añade automáticamente el token en los headers (Authorization: Bearer ) si está definido.
  • Se recomienda almacenar el token en un cache externo si se planea reutilizar entre múltiples instancias o ejecuciones.
  • Compatible con Node.js 18+ y TypeScript 5+.