Backend API

class JupyterMessage

Data structure of a Jupyter message. The documentation is available here : http://jupyter-client.readthedocs.io/en/latest/messaging.html#general-message-format

Created by antoine on 10/05/2017.

public JupyterMessage(Kernel kernel, String msg_type)

Constructor with minimal number of arguments

public JupyterMessage(Kernel kernel, String msg_type, JSONObject parent_header, JSONObject metadata, JSONObject content)

Complete constructor for message to send

public JupyterMessage(Kernel kernel, ArrayList incomingMessage)

public JSONObject getHeader ()

Get the header of the message as a JSONObject. The header contains : String msg_id, String username, String session, String date, String msg_type, String version=”5.0”

public void setParentHeader (JSONObject parent_header)

Set the parent header of the message.

Use it when the message you create respond to another message.

The parent_header must contain : String msg_id, String username, String session, String date, String msg_type, String version=”5.0”

public JSONObject getParentHeader ()

Get the parent header of the message.

The parent_header must contain : String msg_id, String username, String session, String date, String msg_type, String version=”5.0”

public void setMetadata (JSONObject metadata)

Set the metadata part of the message. Its content is free.

public String getHmac ()

Get the HMAC of the message

public JSONObject getMetadata ()

Get the metadata of the message. Its content is free.

public String getUuid ()

Get the universally unique identifier (UUID) of the message

public void setContent (JSONObject content)

Set the content part of the message. It must be a JSON. Its content depends on the type of message, according to this documentation : http://jupyter-client.readthedocs.io/en/latest/messaging.html

public JSONObject getContent ()

Get the content part of the message. It must be a JSON. Its content depends on the type of message, according to this documentation : http://jupyter-client.readthedocs.io/en/latest/messaging.html

public String[] getMessageToSend ()

Get the message serialized in the proper format in order to send it through the channel, using the ZMQ library.

private String generateDate ()

Generate an ISO 8061 compliant timestamp

private String generateHmac()

Generate the Jupypter messaging protocol compliant hmac

private void buildMessage ()

Build the message in accordance with Jupyter messaging specification