Skip to content

Conversation

@david-crespo
Copy link
Collaborator

@david-crespo david-crespo commented Mar 15, 2023

Closes #952

I wrote a little mock server in Deno for local dev. MSW does not support websockets. Propolis has a mock server that can power a serial console when running Nexus with simulated sled agent, but as we know from MSW, having something instant to work with is invaluable.

@vercel
Copy link

vercel bot commented Mar 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
console-ui-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 7, 2023 1:44am

// detect websocket endpoints and give us a helper that constructs a WebSocket
// instead of calling fetch
const wsUrl = `ws://${window.location.host}/v1/instances/${instance}/serial-console/stream?organization=${organization}&project=${project}`
const status = 'connected' // TODO
Copy link
Contributor

@just-be-dev just-be-dev Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might be able to use readyState for this: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState, but it'd require access to the socket.

You may need to move the skeleton inside the terminal component.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha I think we all found this around the same time, I sent the same thing

@david-crespo
Copy link
Collaborator Author

it did somethiiiiiiiiiiiing!

image

@david-crespo
Copy link
Collaborator Author

Here it is running against our little mock.

2023-03-27-mock-serial-console

@david-crespo david-crespo marked this pull request as ready for review March 31, 2023 02:23
@david-crespo
Copy link
Collaborator Author

I tested this with @jmpesp against a Real Instance and it worked to display the serial console steam. Input did not work, but we think it's more like a networking issue than a console issue. We confirmed keypresses were getting sent from the browser, at least. So I'm going to merge and bump the console in omicron. We will get more testing for free that way.

@david-crespo david-crespo enabled auto-merge (squash) April 7, 2023 01:46
@david-crespo david-crespo merged commit b525cac into main Apr 7, 2023
@david-crespo david-crespo deleted the serial-console-ws branch April 7, 2023 01:49
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.

Serial console should use websockets

4 participants