def publish(self, data, metadata=None, source=None): self._flush_streams() if metadata is None: metadata = {} self._validate_data(data, metadata) content = {} content['data'] = encode_images(data) content['metadata'] = metadata self.session.send( self.pub_socket, u'display_data', json_clean(content), parent=self.parent_header, ident=self.topic, )
def write_format_data(self, format_dict, md_dict=None): self.msg['content']['data'] = encode_images(format_dict) self.msg['content']['metadata'] = md_dict