Registry / messaging / hubbie

hubbie

JSON →
library4.2.0jsnpmunverified

WebSocket manager for long-lived client/server connections with automatic reconnection, message queuing, and in-process messaging. Current stable version is 4.2.0. It supports WebSocket clients and servers, HTTP cross-posting for server-to-server communication, and local in-process messaging for testing. Key differentiators include peer authentication via URL path, TLS certificate registration, and unified API for WebSocket and HTTP transports. Suitable for browser extensions, unhosted web apps, and multi-agent systems.

npm install hubbie
INSTALL
IMPORT
SIG · HUBBIE
H
hubbie
messagingjavascriptv4.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Hubbie
const Hubbie = require('hubbie')
import Hubbie from 'hubbie'
Hubbie is CJS-only; no ESM exports as of v4.
Hubbie (ESM)
const { default: Hubbie } = await import('hubbie')
import Hubbie from 'hubbie'
If using ESM, use dynamic import with default extract; named import not supported.

Creates a local WebSocket server and client using Hubbie, demonstrating peer authentication and message exchange.

const Hubbie = require('hubbie'); const server = new Hubbie(); server.listen({ port: 8000 }); server.on('peer', (eventObj) => { if (eventObj.peerSecret === 'secret') { console.log('Accepted', eventObj.peerName); server.send(eventObj.peerName, 'Welcome!'); return Promise.resolve(true); } else { return Promise.resolve(false); } }); server.on('message', (peerName, msg) => { console.log(`Message from ${peerName}:`, msg); }); const client = new Hubbie(); client.addClient({ peerName: 'alice', peerUrl: 'ws://localhost:8000', myName: 'bob', mySecret: 'secret' }); client.send('alice', 'Hello!'); setTimeout(() => { server.close(); client.close(); }, 5000);
Debug
Known issues
gotchaDefaults to no auto-reconnect; must configure manually
fix
Pass reconnect options in client config (e.g., retryInterval).
affects: >=1.0.0
gotchaHubbie#send to unconnected peer silently drops messages
fix
Ensure peer is connected via peer event or addClient before send.
affects: >=1.0.0
deprecatedHubbie#listen({ server }) deprecation warning
fix
Use listen({ port }) or listen({ tls }) instead; passing existing server may cause POST handler conflicts.
affects: >=4.0.0
breakingv4 removed support for Node.js <10
fix
Upgrade Node.js to version 10 or later.
affects: >=4.0.0
gotchaMessages may be delivered out of order if multiple WebSocket connections are open
fix
Use a single connection or implement ordering at application level.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'hubbie'
Package not installed or incorrect import path.
fix
Run 'npm install hubbie' and use 'const Hubbie = require('hubbie');'
TypeError: Hubbie is not a constructor
Using ESM import instead of CommonJS require.
fix
Use 'const Hubbie = require('hubbie');' or dynamic import with default extract.
Error: listen callback must be a function
Missing callback or incorrect arguments to listen().
fix
Call listen with an options object and optionally a callback: server.listen({ port: 8000 }, () => {});
Error: peerSecret is undefined
Client not sending mySecret in addClient options.
fix
Ensure addClient includes mySecret matching server's expected secret.
Upgrade
Version history
4.2.0latest on npm
Audit
Dependencies
wsrequiredWebSocket implementation for Node.js
node-fetchoptionalHTTP client for cross-posting (server-server mode)
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
2
Resources
packagehubbie
hubbie — npm install hubbie · libregistry