File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -65,16 +65,17 @@ containing Javascript to connect to it.
6565
6666.. code-block :: python
6767
68- def target_func (comm , msg ):
68+ def target_func (comm , open_msg ):
6969 # comm is the kernel Comm instance
7070 # msg is the comm_open message
7171
7272 # Register handler for later messages
7373 @comm.on_msg
7474 def _recv (msg ):
7575 # Use msg['content']['data'] for the data in the message
76+ comm.send({' echo' : msg[' content' ][' data' ]})
7677
77- # Send data to the frontend
78+ # Send data to the frontend on creation
7879 comm.send({' foo' : 5 })
7980
8081 get_ipython().kernel.comm_manager.register_target(' my_comm_target' , target_func)
@@ -87,8 +88,7 @@ And then open the comm from the frontend:
8788
8889.. code-block :: javascript
8990
90- comm = Jupyter .notebook .kernel .comm_manager .new_comm (' my_comm_target' ,
91- {' foo' : 6 })
91+ const comm = Jupyter .notebook .kernel .comm_manager .new_comm (' my_comm_target' , {' foo' : 6 })
9292 // Send data
9393 comm .send ({' foo' : 7 })
9494
You can’t perform that action at this time.
0 commit comments