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

@cloudsignal/collaborate

v0.1.1

Published

React collaboration primitives powered by CloudSignal MQTT — cursors, presence, locking, typing indicators, reactions, and shared state

Readme

@cloudsignal/collaborate

Real-time collaboration primitives for React — powered by CloudSignal MQTT.

Drop-in components for cursors, presence, component locking, typing indicators, emoji reactions, shared state, and custom broadcast events.

Install

npm install @cloudsignal/collaborate @cloudsignal/mqtt-client

Quick Start

import { Space, AvatarStack, CursorOverlay, TypingIndicator } from "@cloudsignal/collaborate";

export default function App() {
  return (
    <Space
      id="my-room"
      connection={{
        host: "wss://connect.cloudsignal.app:18885/",
        username: "alice@org_k7xm4pqr2n5t",
        password: "alice-password",
      }}
      userName="Alice"
    >
      <AvatarStack />

      <CursorOverlay>
        <div style={{ width: "100%", height: "500px", background: "#fafafa" }}>
          Move your mouse here
        </div>
      </CursorOverlay>

      <TypingIndicator />
    </Space>
  );
}

Primitives

Provider

| Component | Description | |-----------|-------------| | <Space> | Wraps your app. Manages MQTT connection, presence heartbeats, and topic routing. |

Hooks

| Hook | Returns | Description | |------|---------|-------------| | useSpace() | { spaceId, self, isConnected, error } | Access space context | | usePresence() | { members, count, onJoin, onLeave } | Who's online | | useCursors() | { cursors, publishCursor } | Live cursor positions | | useLock(id) | { isLocked, lockedBy, lock, unlock } | Component locking | | useTypingIndicator() | { typingUsers, startTyping, stopTyping } | Typing state | | useReactions() | { reactions, sendReaction } | Emoji reactions | | useBroadcast(event?) | { broadcast, lastMessage, onMessage } | Custom pub/sub | | useSharedState(key, init) | [value, setValue] | Synced key-value state |

Components

| Component | Description | |-----------|-------------| | <AvatarStack> | Overlapping user avatars with "+N" overflow | | <CursorOverlay> | Wraps content, renders live cursor SVGs | | <TypingIndicator> | "Alice is typing..." with animated dots | | <LockIndicator> | Lock badge showing who's editing | | <ReactionBar> | Emoji buttons with floating animations | | <PresenceBorder> | Auto-locks on focus, colored border per user |

Connection Methods

// Direct credentials
<Space connection={{ host: "wss://...", username: "user@org_id", password: "pass" }} />

// Token auth (secret key)
<Space connection={{ host: "wss://...", organizationId: "uuid", secretKey: "sk_..." }} />

// External IdP (Supabase, Clerk, Firebase, Auth0)
<Space connection={{
  host: "wss://...",
  organizationId: "uuid",
  externalToken: jwt,
  tokenServiceUrl: "https://auth.cloudsignal.app"
}} />

Examples

Collaborative Form

import { Space, AvatarStack, PresenceBorder, TypingIndicator, useTypingIndicator } from "@cloudsignal/collaborate";

function FormFields() {
  const { startTyping } = useTypingIndicator();

  return (
    <>
      <PresenceBorder componentId="title">
        <input onChange={() => startTyping()} placeholder="Title" />
      </PresenceBorder>
      <PresenceBorder componentId="body">
        <textarea onChange={() => startTyping()} placeholder="Description" />
      </PresenceBorder>
      <TypingIndicator />
    </>
  );
}

export default function Page() {
  return (
    <Space id="form-123" connection={conn} userName="Alice">
      <AvatarStack />
      <FormFields />
    </Space>
  );
}

Shared Counter

import { useSharedState } from "@cloudsignal/collaborate";

function Counter() {
  const [count, setCount] = useSharedState("counter", 0);
  return <button onClick={() => setCount(count + 1)}>Clicks: {count}</button>;
}

Real-time Chat via Broadcast

import { useBroadcast } from "@cloudsignal/collaborate";

function Chat() {
  const { broadcast, onMessage } = useBroadcast<{ text: string; from: string }>("chat");
  const [messages, setMessages] = useState<{ text: string; from: string }[]>([]);

  useEffect(() => onMessage(msg => setMessages(prev => [...prev, msg])), []);

  return (
    <div>
      {messages.map((m, i) => <p key={i}><b>{m.from}:</b> {m.text}</p>)}
      <input onKeyDown={e => {
        if (e.key === "Enter") {
          broadcast({ text: e.currentTarget.value, from: "Alice" });
          e.currentTarget.value = "";
        }
      }} />
    </div>
  );
}

Architecture

@cloudsignal/collaborate (this package)
  └── @cloudsignal/mqtt-client (peer dependency — MQTT transport)
        └── VerneMQ broker (CloudSignal infrastructure)

All collaboration data flows over MQTT topics under $spaces/{spaceId}/:

| Topic | QoS | Retain | Purpose | |-------|-----|--------|---------| | $spaces/{id}/presence | 0 | No | Heartbeats, join/leave | | $spaces/{id}/cursors | 0 | No | Cursor positions | | $spaces/{id}/locks | 1 | No | Lock acquire/release | | $spaces/{id}/typing | 0 | No | Typing indicators | | $spaces/{id}/reactions | 0 | No | Emoji reactions | | $spaces/{id}/broadcast/{event} | 0 | No | Custom events | | $spaces/{id}/state/{key} | 1 | Yes | Shared state (LWW) |

Performance

  • Cursors use ref-based storage + imperative DOM updates — zero React re-renders per message
  • Presence and typing use useState since they update at human speed (<1Hz)
  • Single wildcard subscription per space — $spaces/{id}/#
  • Throttled publishing — cursors at ~33Hz, typing at max 1 publish/2s
  • Stale cleanup — cursors fade after 3s, typing clears after 4s, presence after 30s

License

MIT