https://rancher.com/ logo
Title
h

helpful-beard-54962

11/23/2022, 8:21 AM
Did anyone try to use the websocket from the API to connect to the shell of a docker? It seems possible from the code and API spec, but there's no documentation on how to pass the auth tokens in the WS
f

full-painter-23916

11/23/2022, 8:45 AM
WebSockets start as a regular HTTP request, so auth is passed like any other API call. Which is normally the
R_SESS
cookie for the UI… It could be via the
Authorization
header too as far as the API actually cares, but the browser WebSocket clients can't set arbitrary headers. Then the frames are vanilla kubernetes, the first character is a number denoting stdin (0, you send), stdout (1) or stderr (2) and the rest is the message. (There's also a
4
for resizing the terminal) https://github.com/rancher/dashboard/blob/master/shell/components/nav/WindowManager/ContainerShell.vue