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

@nexirift/pulsar-js

v2026.1.7-ptb.1

Published

Misskey SDK for JavaScript

Readme

@nexirift/pulsar.js

Strongly-typed official Pulsar SDK for browsers/Node.js.

NPM

Official Pulsar SDK for JavaScript (TypeScript). Works on browsers and Node.js.

The following features are provided:

  • User authentication
  • API requests
  • Streaming
  • Utility functions
  • Various Pulsar type definitions

Compatible with Pulsar version 2025.12.14-ptb.1 and above.

Install

npm i @nexirift/pulsar-js

Usage

It is convenient to import everything together as follows:

import * as Misskey from '@nexirift/pulsar-js';

For convenience, subsequent code examples assume that you have imported * as Misskey as shown above.

However, this import method prevents tree-shaking, so for use cases where code size is important, we recommend individual imports like the following:

import { api as misskeyApi } from '@nexirift/pulsar-js';

Authenticate

todo

API request

When using the API, initialize an instance of the APIClient class with the server information and access token, then call the request method of that instance to make requests.

const cli = new Misskey.api.APIClient({
	origin: 'https://pulsar.test',
	credential: 'TOKEN',
});

const meta = await cli.request('meta', { detail: true });

The first argument to request is the endpoint name to call, and the second argument is the parameter object. The response is returned as a Promise.

Streaming

pulsar.js streaming provides two classes. One is the Stream class, which manages the streaming connection itself, and the other is the Channel class, which represents the concept of a channel on the stream. When using streaming, first initialize an instance of the Stream class, then use the methods of the Stream instance to obtain instances of the Channel class.

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });
const mainChannel = stream.useChannel('main');
mainChannel.on('notification', notification => {
	console.log('notification received', notification);
});

The connection will automatically reconnect if disconnected.

Connecting to a channel

To connect to a channel, use the useChannel method of the Stream class.

Without parameters

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });

const mainChannel = stream.useChannel('main');

With parameters

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });

const chatChannel = stream.useChannel('chat', {
	other: 'xxxxxxxxxx',
});

Disconnecting from a channel

Call the dispose method of the Channel class.

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });

const mainChannel = stream.useChannel('main');

mainChannel.dispose();

Receiving messages

The Channel class extends EventEmitter, and when a message is received from the server, it emits the payload with the received event name.

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });
const mainChannel = stream.useChannel('main');
mainChannel.on('notification', notification => {
	console.log('notification received', notification);
});

Sending messages

You can use the send method of the Channel class to send messages to the server.

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });
const chatChannel = stream.useChannel('chat', {
	other: 'xxxxxxxxxx',
});

chatChannel.send('read', {
	id: 'xxxxxxxxxx'
});

Connection established event

The _connected_ event of the Stream class is available.

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });
stream.on('_connected_', () => {
	console.log('connected');
});

Connection disconnected event

The _disconnected_ event of the Stream class is available.

const stream = new Misskey.Stream('https://pulsar.test', { token: 'TOKEN' });
stream.on('_disconnected_', () => {
	console.log('disconnected');
});

Connection state

You can check it with the state property of the Stream class.

  • initializing: Before connection is established
  • connected: Connection completed
  • reconnecting: Reconnecting