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

jmp

v2.0.0

Published

Node.js module for creating, parsing and replying to messages of the Jupyter Messaging Protocol (JMP)

Downloads

40,934

Readme

JMP

jmp is an npm module for creating, parsing and replying to messages of the Jupyter Messaging Protocol over ZMQ sockets.

Anouncements

  • Version v2.0.0 does not ship any API changes, but it upgrades to zeromq@5 and thus it requires node v6 or above.

  • Version v1.0.0 is a backwards-compatible change in the API. Now, Message#respond returns the response message, so that users can access properties like the response header.

  • Version v0.7.0 depends on zeromq. zmq-prebuilt has been renamed zeromq and is now maintained by the zeromq organisation.

  • Version v0.6.0 depends on zmq-prebuilt to help with testing. See issue #18.

  • Version v0.5.0 is backwards-incompatible. The attribute Message#blobs has been renamed to Message#buffers. See issue #14.

  • Version v0.4.0 is backwards-incompatible. The attribute Message#signatureOK has been removed. See issue #10.

  • Version v0.2.0 is backwards-incompatible. The attribute Message#parentHeader has been renamed to Message#parent_header. See issue #7.

  • Version v0.1.0 is backwards-incompatible. npm packages depending on the initial release of JMP need to update their dependency field:

"jmp": "<0.1.0",

Install

The latest stable release is published on npm and can be installed by running:

npm install jmp

The master branch in the github repository provides the latest development version and can be installed by:

git clone https://github.com/n-riesco/jmp.git
npm install ./jmp

Branch v0.0 provides the latest version of JMP, backwards-compatible with the first release. It can be installed from npm:

npm install "jmp@<0.1.0"

or github:

git clone -b v0.0 https://github.com/n-riesco/jmp.git
npm install ./jmp

Usage

Import modules

JMP depends on ZMQ and for convenience JMP exports the module zmq:

var crypto = require("crypto");
var uuid = require("uuid/v4");

var jmp = require("jmp");
var zmq = jmp.zmq;

Create JMP sockets

var scheme = "sha256";
var key = crypto.randomBytes(256).toString('base64');

var serverSocket = new jmp.Socket("router", scheme, key);
var clientSocket = new jmp.Socket("dealer", scheme, key);

var address = "tcp://127.0.0.1:8888";

serverSocket.bindSync(address);
clientSocket.connect(address);

Create a JMP message from scratch

var request = new jmp.Message();

request.idents = [];
request.header = {
    "msg_id": uuid(),
    "username": "user",
    "session": uuid(),
    "msg_type": "kernel_info_request",
    "version": "5.0",
};
request.parent_header = {};
request.metadata = {};
request.content = {};

Send a message over a JMP socket

clientSocket.send(request);

Listen on a JMP socket and respond to a message

serverSocket.on("message", onRequest);

function onRequest(msg) {
    var responseMessageType = "kernel_info_reply";

    var responseContent = {
        "protocol_version": "0.0.0",
        "implementation": "kernel",
        "implementation_version": "0.0.0",
        "language_info": {
            "name": "test",
            "version": "0.0.0",
            "mimetype": "text/plain",
            "file_extension": "test",
        },
        "banner": "Test",
        "help_links": [{
            "text": "JMP",
            "url": "https://github.com/n-riesco/nel",
        }],
    };

    var responseMetadata = {};

    msg.respond(
        serverSocket, responseMessageType, responseContent, reponseMetadata
    );
}

Remove listeners and close sockets

serverSocket.removeListener("message", getRequest);
serverSocket.close()
clientSocket.close()

Documentation

Documentation generated using JSDoc can be found here.

Contributions

First of all, thank you for taking the time to contribute. Please, read CONTRIBUTING.md and use the issue tracker for any contributions: support requests, bug reports, enhancement requests, pull requests, ...