diff --git a/IPython/html/static/base/js/comm.js b/IPython/html/static/base/js/comm.js index 3633b74..3351e42 100644 --- a/IPython/html/static/base/js/comm.js +++ b/IPython/html/static/base/js/comm.js @@ -102,29 +102,29 @@ var IPython = (function (IPython) { }; // methods for sending messages - Comm.prototype.open = function (data, callbacks) { + Comm.prototype.open = function (data, callbacks, metadata) { var content = { comm_id : this.comm_id, target_name : this.target_name, data : data || {}, }; - return this.kernel.send_shell_message("comm_open", content, callbacks); + return this.kernel.send_shell_message("comm_open", content, callbacks, metadata); }; - Comm.prototype.send = function (data, callbacks) { + Comm.prototype.send = function (data, callbacks, metadata) { var content = { comm_id : this.comm_id, data : data || {}, }; - return this.kernel.send_shell_message("comm_msg", content, callbacks); + return this.kernel.send_shell_message("comm_msg", content, callbacks, metadata); }; - Comm.prototype.close = function (data, callbacks) { + Comm.prototype.close = function (data, callbacks, metadata) { var content = { comm_id : this.comm_id, data : data || {}, }; - return this.kernel.send_shell_message("comm_close", content, callbacks); + return this.kernel.send_shell_message("comm_close", content, callbacks, metadata); }; // methods for registering callbacks for incoming messages diff --git a/IPython/html/static/services/kernels/js/kernel.js b/IPython/html/static/services/kernels/js/kernel.js index aab04ee..210aad7 100644 --- a/IPython/html/static/services/kernels/js/kernel.js +++ b/IPython/html/static/services/kernels/js/kernel.js @@ -49,7 +49,7 @@ var IPython = (function (IPython) { }; - Kernel.prototype._get_msg = function (msg_type, content) { + Kernel.prototype._get_msg = function (msg_type, content, metadata) { var msg = { header : { msg_id : utils.uuid(), @@ -57,7 +57,7 @@ var IPython = (function (IPython) { session : this.session_id, msg_type : msg_type }, - metadata : {}, + metadata : metadata || {}, content : content, parent_header : {} }; @@ -234,8 +234,8 @@ var IPython = (function (IPython) { // Main public methods. // send a message on the Kernel's shell channel - Kernel.prototype.send_shell_message = function (msg_type, content, callbacks) { - var msg = this._get_msg(msg_type, content); + Kernel.prototype.send_shell_message = function (msg_type, content, callbacks, metadata) { + var msg = this._get_msg(msg_type, content, metadata); this.shell_channel.send(JSON.stringify(msg)); this.set_callbacks_for_msg(msg.header.msg_id, callbacks); return msg.header.msg_id;