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

hrmc

v1.0.5

Published

Hydra Router Message Client

Downloads

3

Readme

hrmc

Hydra Router Message Client

HRMC is a node based REPL which embeds a client app that you can interacively use to establish a WebSocket connection to a Hydra Router. Once connected it can be used to send messages to the Hydra Router, connected Hydra-based services and connected websocket clients.

Installing and running globally

You can install hrmc from NPM and run it as a global command.

$ npm install -g hrmc

Running from a docker container

Hrmc is also available as a docker image.

$ docker run -it cjus/hrmc ./hrmc

Full documentation

The complete documentation can be found here: https://www.hydramicroservice.com/docs/tools/hydra-router/hydra-router-message-client.html

Quick command summary

Display help

➤ client.help();

Open connection to HydraRouter

➤ client.open('ws://localhost:5353');

Close connection to HydraRouter

➤ client.close();

Reopen connection to HydraRouter

➤ client.reopen();

Create a UMF message

➤ client.createMessage();

Send a UMF message to HydraRouter

➤ client.sendMessage('{"to":"hydra-router:/","frm":"9vnwcm1spj@client:/","mid":"d29d78dd-eed5-4378-af18-9bf9c3076578","ts":"2018-02-16T13:32:45.828Z","ver":"UMF/1.4.6","typ":"ping","bdy":{}}');
➤ client.sendMessage('{"to":"hydra-router:[GET]/v1/router/list/services","frm":"28j9ce93lzr@client:/","mid":"d29d78dd-eed5-4378-af18-9bf9c3076578","ts":"2018-02-16T13:32:45.828Z","ver":"UMF/1.4.6","bdy":{}}');

Get router that client is connected to

➤ client.sendMessage('{"to":"hydra-router:/","frm":"1ve4mcame6j@client:/","mid":"5cc4e3f5-ad72-41f3-a23f-212bdabc331f","ts":"2018-02-17T16:02:48.902Z","ver":"UMF/1.4.6","typ": "wsdir.loc","bdy":{"clientID": "asguyv6lq9"}}');

Send message from one client to another through hydrarouter

Uses the UMF forward (short form fwd) key for message forwarding.

➤ client.sendMessage(`{"to": "hydra-router:/", "frm": "1eksqsc6i8f@client:/", "fwd": "2v4n1w7py5@client:/", "mid": "5cc4e3f5-ad72-41f3-a23f-212bdabc331f", "ts": "2018-02-17T16:02:48.902Z", "ver": "UMF/1.4.6", "bdy": {"msg":"Hello from 1yancbc573b"}}`);

Pretty print a JSON string

➤ client.jsonPrint('{"to":"1tbjxsl59lv@client:/","frm":"7dd80a249fa54815bc5cbfc60d344175@hydra-router:/","mid":"364a4eda-0a57-4339-8dd0-e7ebc66c56ce","ts":"2018-02-16T21:50:35.656Z","ver":"UMF/1.4.6","bdy":[{"serviceName":"hydra-router","serviceDescription":"Service Router","version":"1.6.0","instanceID":"7dd80a249fa54815bc5cbfc60d344175","updatedOn":"2018-02-16T21:50:33.383Z","processID":11576,"ip":"10.1.10.5","port":"5353","hostName":"Administrators-MacBook-Pro-2.local","updatedOnTS":1518817835430,"sampledOn":"2018-02-16T21:50:33.383Z","architecture":"x64","platform":"darwin","nodeVersion":"v8.9.4","memory":{"rss":40783872,"heapTotal":21905408,"heapUsed":17851792,"external":84234},"uptimeSeconds":370.59,"log":[{"ts":"2018-02-16T21:43:32.274Z","serviceName":"hydra-router","type":"error","processID":11555,"msg":"Service is shutting down."},{"ts":"2018-02-16T21:41:59.470Z","serviceName":"hydra-router","type":"info","processID":11555,"msg":"Starting service hydra-router:1.6.0 on 10.1.10.5:5353"}]}]}');
➤ client.sendMessage('{"to":"hmr-service:/","frm":"d73qzhco1n@client:/","mid":"d29d78dd-eed5-4378-af18-9bf9c3076578","ts":"2018-02-16T13:32:45.828Z","ver":"UMF/1.4.6","bdy":{}}');