Skip to content
Node.js module for creating, parsing and replying to messages of the Jupyter Messaging Protocol (JMP)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts doc: Publish documentation on gh-pages May 22, 2015
test test: ensure sockets are closed Oct 2, 2018
.eslintrc.yml lint: downgrade to eslint@2 Apr 15, 2018
.gitignore gitignore: Do not track yarn.lock Nov 1, 2016
.npmignore gitignore: Do not track yarn.lock Nov 1, 2016
.travis.yml ⬆️ Required Node versions Oct 2, 2018
AUTHORS Edit Author list Oct 7, 2016 Initial commit Apr 30, 2015
LICENSE Initial commit Apr 30, 2015 doc: announce version 2.0.0 Oct 2, 2018
package.json Version 2.0.0 Oct 2, 2018


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


  • 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",


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
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
npm install ./jmp


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://";


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


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": "",

    var responseMetadata = {};

        serverSocket, responseMessageType, responseContent, reponseMetadata

Remove listeners and close sockets

serverSocket.removeListener("message", getRequest);


Documentation generated using JSDoc can be found here.


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

You can’t perform that action at this time.