8000 Use IPython 1.0-compatible "handshake" to open kernel channels by tkf · Pull Request #122 · tkf/emacs-ipython-notebook · GitHub
[go: up one dir, main page]

Skip to content

Use IPython 1.0-compatible "handshake" to open kernel channels #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions lisp/ein-kernel.el
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,14 @@ See: https://github.com/ipython/ipython/pull/3307"
The kernel will no longer be responsive.")))


(defun ein:kernel-send-cookie (channel host)
(defun ein:kernel-send-cookie (channel kernel)
;; cookie can be an empty string for IPython server with no password,
;; but something must be sent to start channel.
(let ((cookie (ein:query-get-cookie host "/")))
(ein:websocket-send channel cookie)))
(let* ((url-or-port (ein:$kernel-url-or-port kernel))
(host (if (stringp url-or-port) url-or-port ein:url-localhost))
(cookie (ein:query-get-cookie host "/"))
(session-id (ein:$kernel-session-id kernel)))
(ein:websocket-send channel (format "%s:%s" session-id cookie))))


(defun ein:kernel--ws-closed-callback (websocket kernel arg)
Expand Down Expand Up @@ -214,14 +217,9 @@ See: https://github.com/ipython/ipython/pull/3307"
do (setf (ein:$websocket-onclose-args c) (list kernel onclose-arg))
do (setf (ein:$websocket-onopen c)
(lexical-let ((channel c)
(kernel kernel)
(host (let (url-or-port
(ein:$kernel-url-or-port kernel))
(if (stringp url-or-port)
url-or-port
ein:url-localhost))))
(kernel kernel))
(lambda ()
(ein:kernel-send-cookie channel host)
(ein:kernel-send-cookie channel kernel)
;; run `ein:$kernel-after-start-hook' if both
;; channels are ready.
(when (ein:kernel-live-p kernel)
Expand Down
0