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

Support building for WASM #213

Open
flimzy opened this issue Aug 18, 2024 · 3 comments
Open

Support building for WASM #213

flimzy opened this issue Aug 18, 2024 · 3 comments

Comments

@flimzy
Copy link

flimzy commented Aug 18, 2024

At present, this package fails to build for WASM:

../../../../go/pkg/mod/golang.stackrox.io/[email protected]/client/ws_proxy.go:235:3: unknown field HTTPHeader in struct literal of type websocket.DialOptions
../../../../go/pkg/mod/golang.stackrox.io/[email protected]/client/ws_proxy.go:236:3: unknown field HTTPClient in struct literal of type websocket.DialOptions
../../../../go/pkg/mod/golang.stackrox.io/[email protected]/client/ws_proxy.go:239:3: unknown field CompressionMode in struct literal of type websocket.DialOptions

This is due to the fact that github.com/coder/websocket exposes different DialOptions structs for WASM than for other targets. There is an issue open that would address at least some of this, but it's old and hasn't gotten much attention.

Unless/until github.com/coder/websocket addresses this issue, is it reasonable for go-grpc-http1 to put the DialOptions use behind a build tag, so that it can compile for web assembly?

I'm happy to submit a pull request if it's likely to be accepted.

@RTann
Copy link
Collaborator

RTann commented Oct 10, 2024

Hi, thank you for your interest in this library, and apologies for the delay. I'm not very familiar with WASM, honestly, so I'm not familiar with the limitations which are in place when using it.

Looking at the DialOptions for WASM, it looks like it lacks HTTPHeader, HTTPClient, and CompressionMode, which we use. I'm not opposed to controlling the DialOptions behind a build tag, but I'm wondering if it will work correctly without setting those options, especially the headers, which helps identify this as gRPC.

What did you have in mind as replacement DialOptions?

@flimzy
Copy link
Author

flimzy commented Oct 14, 2024

I think the simplest solution would be just to use the same DialOptions for all build tags, and just document that certain of them are ignored for wasm builds.

@vikin91
Copy link
Contributor

vikin91 commented Oct 25, 2024

@flimzy your pull request would be very welcome here. If you find time to submit it, Ross or I can give it a look.

I apologize for our delayed reaction. Your initial message arrived in a vacation season and I am sure that our reaction time will be much better now.

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

No branches or pull requests

3 participants