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

Accept Deno.HttpClient instance for WebSocketStream API #11846

Open
danopia opened this issue Aug 26, 2021 · 2 comments
Open

Accept Deno.HttpClient instance for WebSocketStream API #11846

danopia opened this issue Aug 26, 2021 · 2 comments
Labels
ext/websocket related to the ext/websocket crate suggestion suggestions for new features (yet to be agreed) web related to Web APIs

Comments

@danopia
Copy link
Contributor

danopia commented Aug 26, 2021

The options bag accepted by WebSocketStream should be extended to accept a Deno.HttpClient object. This would enable trusting specific TLS server certificates, and also Mutual TLS / Client Certificate support. There's also a proxy field in Deno.CreateHttpClientOptions which presumably also applies to WebSockets.

For context, both APIs here are currently unstable in Deno. The upstream WebSocketStream spec does not allow for customizing TLS as it is intended for a web browser context, like fetch.

Brief example code:

const client = Deno.createHttpClient({
  caData: await Deno.readTextFile("./ca.pem"),
});

const ws = new WebSocketStream("https://myserver.com", { client });
@lucacasonato lucacasonato added the suggestion suggestions for new features (yet to be agreed) label Aug 26, 2021
@kitsonk kitsonk added ext/websocket related to the ext/websocket crate web related to Web APIs labels Aug 26, 2021
@okikio-school
Copy link

okikio-school commented Mar 2, 2023

Is this something Deno is interested in supporting? cc @lucacasonato

@danopia
Copy link
Contributor Author

danopia commented Aug 8, 2023

I'm still looking for TLS abilities on WebSockets to match the TLS abilities of fetch() :) Kubernetes loves network certificates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext/websocket related to the ext/websocket crate suggestion suggestions for new features (yet to be agreed) web related to Web APIs
Projects
None yet
Development

No branches or pull requests

4 participants