I'm working on writing a small wrapper for the notebook, which is 
essentially a single-tab browser.  I basically have it working so that I 
can do

jupyter notebook --browser="my_wrapper"

and it launches in my little wrapper.

The only problem is that the notebook server remains running in a console 
window and has to be manually closed with Ctrl-C.

What I would like is the ability to start a notebook server that would 
automatically shut down once the associated browser is closed.  Looking at 
old messages on the list, I get the impression this isn't possible.  Is 
that correct?

It seems like it would be possible to implement this by having JavaScript 
in the notebook page send keepalive messages back to the server.  These 
would serve as a sort of "dead man's switch" --- as long as the page 
remained open, the server would remain alive, but when the browser (or tab 
in a multi-tab browser) was closed, the cessation of keepalive messages 
would tell the server to shut itself down.  Is this feasible?

Failing that, I've also been looking for documentation on how to 
programmatically start the notebook server.  That is, supposing I'm running 
some Python code, how can I, from within that code, do the equivalent of 
"jupyter notebook --no-browser", and get the login token returned as a 
string so that I can redirect my wrapper to the appropriate URL?  Right now 
the only way I can see is to actually run jupyter using subprocess and 
parse the output, but that seems rather awkward.  Is there a part of the 
notebook that I can import as a module and do something like "server = 
notebook.start_server()" and then "token = server.token"?

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/e4f279de-7963-4b50-8eef-008af1b3cad6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to