Module Jupyter.Message

Messaging in Jupyter

Headers

type header = {
  1. msg_id : string;
    (*

    typically UUID, must be unique per message

    *)
  2. msg_type : string;
    (*

    the kind of message

    *)
  3. session : string;
    (*

    typically UUID, should be unique per session

    *)
  4. date : string option;
    (*

    ISO8601 timestamp for when the message is created

    *)
  5. username : string;
    (*

    the current username

    *)
  6. version : string;
    (*

    the message protocol version

    *)
}
val header_of_yojson : Ppx_yojson_conv_lib.Yojson.Safe.t -> header
val yojson_of_header : header -> Ppx_yojson_conv_lib.Yojson.Safe.t
val header_of_string : string -> header
val header_option_of_string : string -> header Json.option_try
val string_of_header : header -> string
val string_of_header_option : header option -> string

Top-level message

type 'content t = {
  1. zmq_ids : string list;
  2. content : 'content;
    (*

    The actual content of the message must be a dict, whose structure depends on the message type.

    *)
  3. header : header;
    (*

    The message header contains a pair of unique identifiers for the originating session and the actual message id, in addition to the username for the process that generated the message. This is useful in collaborative settings where multiple users may be interacting with the same kernel simultaneously, so that frontends can label the various messages in a meaningful way.

    *)
  4. parent_header : header option;
    (*

    In a chain of messages, the header from the parent is copied so that clients can track where messages come from.

    *)
  5. metadata : string;
    (*

    Any metadata associated with the message.

    *)
  6. buffers : string list;
    (*

    optional: buffers is a list of binary data buffers for implementations that support binary extensions to the protocol.

    *)
}
val t_of_yojson : 'content. (Ppx_yojson_conv_lib.Yojson.Safe.t -> 'content) -> Ppx_yojson_conv_lib.Yojson.Safe.t -> 'content t
val yojson_of_t : 'content. ('content -> Ppx_yojson_conv_lib.Yojson.Safe.t) -> 'content t -> Ppx_yojson_conv_lib.Yojson.Safe.t
val epoch_to_iso8601_string : float -> string
val create_next : ?time:float -> content_to_yojson:('a -> [> `List of [> `String of string ] list ]) -> 'b t -> 'a -> 'a t
val create_next_shell : ?time:float -> 'a t -> Shell.reply -> Shell.reply t
val create_next_iopub : ?time:float -> 'a t -> Iopub.reply -> Iopub.reply t
val create_next_stdin : ?time:float -> 'a t -> Stdin.reply -> Stdin.reply t

Messages

type request =
  1. | SHELL_REQ of Shell.request t
  2. | STDIN_REQ of Stdin.request t
val request_of_yojson : Ppx_yojson_conv_lib.Yojson.Safe.t -> request
val yojson_of_request : request -> Ppx_yojson_conv_lib.Yojson.Safe.t
type reply =
  1. | SHELL_REP of Shell.reply t
  2. | IOPUB_REP of Iopub.reply t
  3. | STDIN_REP of Stdin.reply t
val reply_of_yojson : Ppx_yojson_conv_lib.Yojson.Safe.t -> reply
val yojson_of_reply : reply -> Ppx_yojson_conv_lib.Yojson.Safe.t