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

Document Websocket API / How do get a Jupyter URL #54

Closed
mccalluc opened this issue Jun 28, 2022 · 1 comment
Closed

Document Websocket API / How do get a Jupyter URL #54

mccalluc opened this issue Jun 28, 2022 · 1 comment

Comments

@mccalluc
Copy link
Contributor

In particular (copied from slack):

You would connect to the websocket for that job and read the connection_details for the url_path and url_domain, that will be the URL for the JupyterLab UI:

{
  "current_job_details": {
    "message": "Webserver ready.", 
    "proxy_details": {"path": "/passthrough/172dfcbbdab3/47/lab?token=TOKEN", "port": 8888, "hostname": "localhost"},
    "connection_details": {"url_path": "/passthrough/172dfcbbdab3/47/lab?token=TOKEN", "url_domain": "https://workspaces-pt.dev.hubmapconsortium.org/"}
  },
  "request_job_details": {}
}

and

    document.cookie = 'token=xxxx'
    let socket = new WebSocket("wss://ws-workspaces-api.dev.hubmapconsortium.org/jobs/47/",[]);fetch('https://workspaces-api.dev.hubmapconsortium.org/job_types/').catch(error => {
      console.error('Error:', error);
    })socket.onopen = function(e) {
      alert("[open] Connection established");
      alert("Sending to server");
    };socket.onmessage = function(event) {
        console.log(event.data)
    };socket.onclose = function(event) {
      if (event.wasClean) {
        alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
      } else {
        // e.g. server process killed or network down
        // event.code is usually 1006 in this case
        alert('[close] Connection died');
      }
    };socket.onerror = function(error) {
      alert(`[error] ${error.message}`);
    };
@jpuerto-psc
Copy link
Collaborator

Closing this and including it on the documentation 2.0 issue.

@shirey shirey added this to Pitt HIVE Jun 7, 2024
@shirey shirey moved this to Done in Pitt HIVE Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants