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

@epimodev/json-websocket

v0.1.4

Published

Create a websocket server with a jsonlines file

Downloads

9

Readme

json-websocket: create websocket with just a jsonlines file

Presentation

json-websocket is a cli which makes possible to create a WebSocket with a jsonlines file (more info about jsonlines here: http://jsonlines.org/).
It's like json-server, but it creates a WebSocket instead of a REST api.

Motivation

Initially I made this project to help people have the same experience as PandaScore live api without waiting for a live match.
But it will help us also create WebSocket with fake data for our development environment.
We can also imagine with this tool a way to reproduce some bugs related to realtime.

Instalation

# install locally in your project
yarn add @epimodev/json-websocket
# install globally
yarn global add @epimodev/json-websocket

# or with npm
npm install @epimodev/json-websocket
# install globally
npm install --global @epimodev/json-websocket

Usage

# start a WebSocket server which sends events stored in `live_frames.jsonl` (jsonl is the extension for jsonlines files)
json-websocket live_frames.jsonl

# start a WebSocket server binded to 8080 port
json-websocket live_frames.jsonl --port 8080

# start a WebSocket server with timestamp stored in `current_timestamp` field of each line
# this is usefull to reproduct exactly the same intervals as the recorded WebSocket
json-websocket live_frames.jsonl --timer_field current_timestamp

# start a WebSocket server with an interval of 2 seconds between each event sent
json-websocket live_frames.jsonl --interval 2

Options

Description
  Run a websocket server with a jsonlines file

Usage
  $ json-websocket [file_path] [options]

Options
  --host               Hostname to bind  (default localhost)
  -p, --port           Port to bind  (default 4000)
  -d, --delay          delay before sending first message (in seconds)  (default 0)
  -f, --timer_field    field to get interval between two messages (in seconds)
  --fast_forward       decrease interval between messages, works only with timer_field (value is a factor)  (default 1)
  -i, --interval       interval between 2 messages in seconds if there isn't any field giving the information  (default 1)
  -v, --version        Displays current version
  -h, --help           Displays this message

Examples
  $ json-websocket my_events.jsonl
  $ json-websocket my_events.jsonl --port 8080

Ways of improvements

  • display number of connected clients
  • improve logs about messages send
  • add a progress bar
  • add unit tests