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

symple-client

v4.0.1

Published

Symple realtime messaging and presence client

Readme

Symple Client

Realtime messaging and presence client for the Symple protocol over native WebSocket.

Part of the Symple ecosystem:

Features

  • Connect and authenticate with a Symple server
  • Peer presence - online/offline status, capabilities
  • Scoped messaging - direct, room, or broadcast
  • Dynamic rooms - join and leave at runtime
  • Roster management - automatic peer tracking
  • Reconnection - configurable automatic reconnection
  • Zero dependencies - uses the native WebSocket API (browser or Node.js 22+)
  • ES modules - clean ESM imports, tree-shakeable

Install

npm install symple-client

Quick Start

import SympleClient from 'symple-client'

const client = new SympleClient({
  url: 'ws://localhost:4500',
  peer: {
    user: 'alice',
    name: 'Alice'
  }
})

client.on('connect', () => {
  console.log('Connected as', client.peer.name)

  // Join a room
  client.join('general')

  // Send a message
  client.send({
    type: 'message',
    body: 'Hello everyone!'
  })
})

client.on('message', (m) => {
  console.log('Message from', m.from, ':', m.body)
})

client.on('addPeer', (peer) => {
  console.log('Peer joined:', peer.name)
})

client.on('removePeer', (peer) => {
  console.log('Peer left:', peer.name)
})

client.on('error', (error, message) => {
  console.error('Error:', error, message)
})

client.connect()

Authentication

To use token-based authentication (when the server has SYMPLE_AUTHENTICATION=true):

const client = new SympleClient({
  url: 'wss://your-server.com',
  token: 'your-session-token',
  peer: {
    user: 'alice',
    name: 'Alice'
  }
})

API

new SympleClient(options)

| Option | Type | Default | Description | | --- | --- | --- | --- | | url | string | ws://localhost:4500 | Server WebSocket URL | | token | string | - | Authentication token | | peer | object | {} | Peer info (user, name, type) | | reconnection | boolean | true | Enable automatic reconnection | | reconnectionDelay | number | 3000 | Reconnection delay in ms | | reconnectionAttempts | number | 0 | Max attempts (0 = unlimited) |

Methods

| Method | Description | | --- | --- | | connect() | Connect to the server | | disconnect() | Disconnect from the server | | shutdown() | Disconnect and destroy the socket | | send(message, to?) | Send a message | | sendMessage(message, to?) | Send a typed message | | sendPresence(presence?) | Broadcast presence | | join(room) | Join a room | | leave(room) | Leave a room | | addCapability(name, value?) | Add a peer capability | | removeCapability(name) | Remove a peer capability | | hasCapability(peerId, name) | Check if a peer has a capability | | getCapability(peerId, name) | Get a peer's capability value |

Events

| Event | Payload | Description | | --- | --- | --- | | connect | - | Connected and authenticated | | disconnect | - | Disconnected from server | | reconnect_attempt | attempt | Reconnection attempt | | connect_error | error | Connection failed | | error | error, message | Error occurred | | message | message | Message received | | presence | presence | Presence update | | command | command | Command received | | event | event | Event received | | addPeer | peer | Peer joined | | removePeer | peer | Peer left |

Properties

| Property | Type | Description | | --- | --- | --- | | online | boolean | Whether the client is connected | | peer | object | The local peer object | | roster | Roster | Connected peers roster |

Exports

// Default export
import SympleClient from 'symple-client'

// Named exports
import { SympleClient, Symple, Emitter, Store, Roster } from 'symple-client'

Debug Logging

Enable debug output:

import { Symple } from 'symple-client'
Symple.debug = true

More Information

For more details, visit 0state.com/symple.

License

MIT