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

nstomp

v1.2.0

Published

CLI for testing WebSocket with STOMP protocol from terminal.

Downloads

8

Readme

nstomp

This module is designed to test a websocket connection using the stomp protocol; nstomp allows you to listen to destinations, send messages to them, sending headers when connecting, listening and sending messages is also supported.

To install enter

npm install nstomp --global

Options

| Option | Description | |-------------------------------------|----------------------------------------------------| | -v, --version | output the version number | | -u, --url | url where need connect, headers by needed | | -d, --destination | destination for subscription or message sending, headers by needed | | -m, --message | message to send | | -c, --config | path to config file with options | | -f, --files | path's to files which need send | | -sj, --sock-js | enable connection with SockJS. | | -l, --logs | show logs of libraries used in nstomp. | | -h, --help | display help for command |

Options for config file

| Option | Description | Require | Type | |--------------------|--------------------------------------------------|---------|--------| | url | url where need connect | ✅ | string | | connectionHeaders | headers for connection | ❎ | object | | destination | destination for subscription or message sending | ❎ | string | | destinationHeaders | headers for destination | ❎ | object | | message | message to send | ❎ | string or number or object | | files | path's to files which need send | ❎ | string[] | | withSockJS | enable connection with SockJS. | ❎ | boolean | | logs | show logs of libraries used in nstomp. | ❎ | boolean |

Usage example:

1. Listening

we need to connect to http://localhost:3001/stomp, which requires the headers:

{
  "header1": 12,
  "header2": "value2"
}

and start listening to the destination /get

nstomp -u http://localhost:3001/stomp '{"header1": 12, "header2": "value2"}' -d /get
  1. Connect to: -u http://localhost:3001/stomp
  2. Setup connection headers: '{"header1": 12, "header2": "value2"}'
  3. Setup destination: -d /get

Config file example:

{
    "url": "http://localhost:3001/stomp",
    "connectionHeaders": {
      "header1": 12,
      "header2": "value2"
    },
    "destination": "/get",
}

2. Send message

We need send message to destination /msg with headers:

{
    "header1": 12,
    "header2": "value2",
}

Command example:

nstomp -u http://localhost:3001/stomp -d /msg '{"header1": 12, "header2": "value2"}' -m '{"message": "hello world", "exp": 123445 }'
  1. Connect to: -u http://localhost:3001/stomp
  2. Setup destination: -d /msg
  3. Headers to send: '{"header1": 12, "header2": "value2"}'
  4. Message to send [message can be any string] : -m '{"message": "hello world", "exp": 123445 }'

Config file example:

{
    "url": "http://localhost:3001/stomp",
    "destination": "/msg",
    "destinationHeaders": {
      "header1": 12,
      "header2": "value2"
    },
    "message": {
      "message": "hello world", 
      "exp": 123445
    }
}

3. Send file

We need send flies to destination /files :

files:

  1. image1.png
  2. image2.jpeg
  3. data.json
nstomp -u http://localhost:3001/stomp -d /files -f image1.png image2.jpeg data.json
  1. Connect to: -u http://localhost:3001/stomp
  2. Setup destination: -d /get
  3. Setup list of files to send: image1.png image2.jpeg data.json

Config file example:

{
    "url": "http://localhost:3001/stomp",
    "destination": "/files",
    "files": ["image1.png", "image2.jpeg", "data.json"]
}

In all examples, of course, there should be your endpoints, addressees, headers and messages