# Embedding Jupyter/IPython in a client/server application

**URL:** <https://discourse.jupyter.org/t/embedding-jupyter-ipython-in-a-client-server-application/2547>\
**Category:** General\
**Created:** [October 28, 2019, 2:03pm UTC](https://discourse.jupyter.org/t/embedding-jupyter-ipython-in-a-client-server-application/2547 "2019-10-28T14:03:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sykloid](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/sykloid/32/1246_2.png) [@sykloid](https://discourse.jupyter.org/u/sykloid)\
**Post date:** [October 28, 2019, 2:03pm UTC](https://discourse.jupyter.org/t/embedding-jupyter-ipython-in-a-client-server-application/2547/1 "2019-10-28T14:03:52Z")

</div>

Hello all,

I’m implementing an application with clients communicating with a server over ZeroMQ. I’d like one of the server’s functionalities to be the hosting of a shared python kernel, allowing clients to connect an ipython shell or a web-based notebook interface and interact with the shared state.

I did a bunch of reading, and as a result I’m thoroughly confused on which parts of Jupyter/IPython I should be using to get this done.

1. What’s the appropriate way to start/stop a kernel from inside a python application, such that other hosts can connect to it?
2. If the answer is (unsurprisingly) `embed_kernel`, how should I communicate connection information to clients?
3. On the client side, is there a component I can use to connect to the above kernel already, or should I be writing my own component that speaks the protocol?
4. One of the features I’d like to support is asynchronous injection of state into the running kernel, possibly notifying all clients that a piece of shared state has been updated. Is this possible?

In the middle of all of this, I’ve been reading about kernel gateways, and I can’t quite seem to figure out whether it can be used programmatically.

---

<div class="post-metadata">

**Author:** ![rolweber](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/rolweber/32/657_2.png) [@rolweber](https://discourse.jupyter.org/u/rolweber)\
**Post date:** [October 30, 2019, 12:39pm UTC](https://discourse.jupyter.org/t/embedding-jupyter-ipython-in-a-client-server-application/2547/2 "2019-10-30T12:39:09Z")

</div>

Kernel Gateway provides an HTTP+WebSockets interface to kernel management and kernels. I’d recommend to look into the current development of jupyter\_server though, if you’re interested in running your client over those protocols.

If you want to use ZeroMQ directly over the network, you’ll need something else than Kernel Gateway. You’ll probably have to implement authorization yourself, too.
