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

stockings-client

v0.2.1

Published

Client for the socketized observable framework

Readme

Stockings Client

Client for the socketized observable framework

Installation

npm install stockings-client

Usage

Create a client

Minimal configuration:

import { StockingsClient } from 'stockings-client'
let client = new StockingsClient() // connects to the host and port of the current URL

Specifying port:

import { StockingsClient } from 'stockings-client'
let client = new StockingsClient(3000) // connects to the host of the current URL at the specified port

Specifying host and port:

import { StockingsClient } from 'stockings-client'
let client = new StockingsClient('ws://localhost:3000') // connects to the given host and port

Advanced configuraiton with port and/or host:

import { StockingsClient, SocketConnection } from 'stockings-client'
let client = new StockingsClient({
  socketEndpoint: 'ws://localhost:3000', // specify host:port or just port
  waitUntilToken: false // don't wait until the token is recieved before making any requests
})

Advanced configuraiton with socket connection:

import { StockingsClient, SocketConnection } from 'stockings-client'
let connection = new SocketConnection('ws://localhost:3000') // only accepts full host:port
let client = new StockingsClient({
  socket: connection, // specify your own connection
  waitUntilToken: false // don't wait until the token is recieved before making any requests
})

Make a request

Minimal GET request:

function setUser(user) {
  // do something
}
let subscription = client.request('/api/user/123').subscribe(setUser)

Using another HTTP method:

let subscription = client.request({
  url: '/api/user',
  method: 'POST',
  body: user
}).subscribe()

Advanced request:

import { HttpHeadersFromDictionary }
let subscription = client.request({
  url: '/api/user',
  method: 'GET',
  search: 'skip=10&limit=5',
  headers: {
    auth: jwt
  },
  responseType: 'blob'
}).subscribe(usersBlob => {
  // do something
})

Cancelling subscriptions

subscription.unsubscribe()

Unsubscribing automatically stops listening for any socket events associated with the request, unless it is also used by another open request subscription.

Usage with Angular

Setup within module:

@NgModule({
  // ...
  providers: [
    // ...
    { provide: StockingsClient, useValue: client }
  ],
  // ...
})
export class AppModule { }

Usage within a component

@Component({
  selector: 'app-user',
  template: '<div>{{ user | async }}</div>'
})
export class UserComponent implements OnInit {
  @Input() userId: number
  user: Observable<User>

  constructor(private client: StockingsClient) {}

  ngOnInit() {
    this.user = this.client.request<User>(`/api/user/${this.userId}`)
  }
}