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 🙏

© 2024 – Pkg Stats / Ryan Hefner

websocket-lab

v1.0.0

Published

WebSocket Lab is a straightforward tool for running a WebSocket server when you need to test WebSocket clients. Think of it like a [JSONPlaceholder](https://jsonplaceholder.typicode.com/) for WebSocket that you run locally.

Downloads

2

Readme

WebSocket Lab

WebSocket Lab is a straightforward tool for running a WebSocket server when you need to test WebSocket clients. Think of it like a JSONPlaceholder for WebSocket that you run locally.

Usage

Start the WebSocket server on port 8181 with this command:

npx websocket-lab

[!TIP] You can find more options, like how to run on a different port, by running npx websocket-lab --help.

That's it! Your WebSocket server is up and running. Test your WebSocket clients hassle-free.

[!NOTE] To use WebSocket Lab, you must have Node.js installed on your system. If you don't have Node.js installed, you can download and install it from https://nodejs.org/.

Interacting with the WebSocket Server

Once the server is running, you can connect to it using any WebSocket client. Here's a simple example using JavaScript in a browser:

  1. Open your browser and navigate to about:blank.
  2. Open the browser's developer console.
  3. Copy and paste the following JavaScript code into the console:
// Create a new WebSocket instance, connecting to the server running on port 8181
const socket = new WebSocket('ws://localhost:8181')

// Listen for the 'open' event to send a message
socket.onopen = function (event) {
  console.log('Connection established')

  // Now it's safe to send a message
  socket.send('Hello, WebSocket Lab!')
}

// Listen for messages from the server
socket.onmessage = function (event) {
  console.log('Message from server:', event.data)
}

// To close the connection, use `socket.close()`

License

WebSocket Lab is licensed under the MIT License. See the LICENSE for details.