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

smserver-client

v1.0.1

Published

TypeScript client for SMServer — iMessage gateway API

Readme

smserver-client

TypeScript client for SMServer — the iMessage gateway for jailbroken iOS devices.

Uses got for HTTP and ws for WebSocket with full EventEmitter-based real-time events.

Install

npm install smserver-client

Example

import { SMServerClient } from "smserver-client";

const client = new SMServerClient({ httpPort: 8085, wsPort: 8081, password: "toor" });

await client.authenticate("toor");
await client.connect();

// Send a message
await client.sendMessage({ chat: "+15551234567", text: "Hey!" });

// Auto-reply "Pong" when someone sends "Ping"
client.on("newMessage", async (msg) => {
  if (!msg.is_from_me && msg.text?.trim().toLowerCase() === "ping") {
    await client.sendMessage({ chat: msg.chat_identifier, text: "Pong" });
  }
});

Quick Start

import { SMServerClient } from "smserver-client";

// Full URLs
const client = new SMServerClient({
  baseUrl: "http://localhost:8085",
  wsUrl: "ws://localhost:8081",
  password: "toor",
});

// Or just ports (host defaults to localhost)
const client = new SMServerClient({
  httpPort: 8085,
  wsPort: 8081,
  password: "toor",
});

// Remote device
const client = new SMServerClient({
  host: "192.168.1.50",
  httpPort: 8741,
  wsPort: 8740,
  password: "toor",
});

// Authenticate
await client.authenticate("toor");

// Get recent chats
const chats = await client.getChats();
console.log(chats);

// Get messages from a conversation
const messages = await client.getMessages("+15551234567", {
  numMessages: 50,
});
console.log(messages);

// Send a text
await client.sendMessage({
  chat: "+15551234567",
  text: "Hello from Node.js!",
});

// Connect WebSocket for real-time events
await client.connect();

client.on("newMessage", (msg) => {
  console.log("New message:", msg.text, "from", msg.chat_identifier);
});

client.on("messageTyping", ({ chat, active }) => {
  console.log(chat, active ? "is typing..." : "stopped typing");
});

client.on("messageViewed", ({ guid, date_read }) => {
  console.log("Message", guid, "read at", date_read);
});

client.on("batteryStatus", ({ percentage, charging }) => {
  console.log(`Battery: ${percentage}%`, charging ? "(charging)" : "");
});

API

new SMServerClient(options?)

| Option | Default | Description | |--------|---------|-------------| | baseUrl | http://localhost:8085 | SMServer HTTP API URL | | wsUrl | ws://localhost:8081 | SMServer WebSocket URL | | host | localhost | Host for port-based shorthand | | httpPort | — | HTTP port — auto-generates baseUrl | | wsPort | — | WebSocket port — auto-generates wsUrl | | password | — | Auto-authenticate on construction |

REST Methods

All methods return Promises.

| Method | Description | |--------|-------------| | authenticate(password) | Authenticate with server password | | getMessages(chatId, opts?) | Get messages for a chat | | getChats(opts?) | List recent conversations | | getConversation(chatId) | Get conversation details | | getName(chatId) | Resolve display name for a chat ID | | searchMessages(term, opts?) | Full-text search across messages | | matchContacts(value, type?) | Find contacts by partial match | | getPhotos(opts?) | List camera roll photos | | getConfig() | Get server configuration | | sendMessage(params) | Send a text/attachment message | | sendTapback(type, guid, remove?) | Send/remove message reaction | | deleteChat(chatId) | Delete entire conversation | | deleteText(guid) | Delete a single message | | getAttachment(path) | Download attachment file as Buffer | | getProfilePicture(chatId) | Download profile picture as Buffer | | getPhotoFile(path) | Download camera roll photo as Buffer |

WebSocket Events

client.on("newMessage",       (msg: Message) => {})
client.on("messageTyping",    (ev: TypingEvent) => {})
client.on("messageViewed",    (ev: MessageReadEvent) => {})
client.on("batteryStatus",    (ev: BatteryEvent) => {})
client.on("tapbackSent",      (ev: TapbackEvent) => {})
client.on("connected",        () => {})
client.on("disconnected",     (code: number, reason: string) => {})
client.on("error",            (err: Error) => {})

WebSocket Methods

| Method | Description | |--------|-------------| | connect() | Open WebSocket connection | | disconnect() | Close WebSocket connection | | sendTyping(chat, active) | Send typing indicator |

Build

npm run build        # tsdown (ESM + CJS + types)
npm run typecheck    # tsc --noEmit
npm run debug        # interactive WebSocket message monitor
npm run debug:headless  # non-interactive (just log to file)

Debug Server

Built-in WebSocket monitor that logs every message type and saves raw JSONL:

npm run debug

# Custom endpoints
npm run debug -- --ws ws://192.168.1.50:8081 --http http://192.168.1.50:8085

# Custom output directory
npm run debug -- --out ./my-session

Interactive commands: s = print stats, r = reconnect, q = quit. Raw messages saved to ./debug-output/raw-<timestamp>.jsonl.

License

MIT