Skip to content
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

Read websocket frame until completed #555

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kwrooijen
Copy link

@kwrooijen kwrooijen commented Aug 24, 2024

Problem

I was trying out emacs-jupyter to connect to Paperspace Gradient using their token authenticated remote kernel. I noticed that some code executions didn't output anything (e.g. .describe()).

Solution

It turns out that the current :on-message handler doesn't properly handle partial messages. If websocket-frame-completep returns nil we should wait for the next frame and accumulate the message.

We also add continuation websocket-frame-opcode as a valid string response. I'm not sure what impact this will have since continuation isn't actually a type like text or binary

Note

For those interested in connecting to Paperspace Gradient; you have to connect WITHOUT using a port. AFAIK emacs-jupyter won't let you set the port to nil in org, so you have to manually override jupyter-tramp-url-from-file-name and set port to nil

jupyter/jupyter-tramp.el

Lines 282 to 289 in f97f4b5

(defun jupyter-tramp-url-from-file-name (filename)
"Return a URL string based off the method, host, and port of FILENAME."
(with-parsed-tramp-file-name filename nil
(unless port (setq port (when (functionp 'tramp-file-name-port-or-default)
;; This function was introduced in Emacs 26.1
(tramp-file-name-port-or-default v))))
(format "%s://%s%s" (if (equal method "jpys") "https" "http")
host (if port (format ":%s" port) ""))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant