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

Enable tests for WASM once WASM supports it #5

Open
at-wat opened this issue Jan 13, 2020 · 10 comments
Open

Enable tests for WASM once WASM supports it #5

at-wat opened this issue Jan 13, 2020 · 10 comments

Comments

@at-wat
Copy link
Member

at-wat commented Jan 13, 2020

WASM is still in Minimum Viable Product stage. IP socket is not yet supported and net_fake.go is used in Go1.13.
A lot of the tests using net.Conn fail to be built, deadlock, or cause below runtime error in net_fake.go.

panic: interface conversion: net.sockaddr is *net.UDPAddr, not *net.TCPAddr

Now, some tests in dtls, ice, sctp, transport, turn, and webrtc packages are disabled.
Once WASM and Go support UDP connection, we can enable them.

ref: #4 (comment)

@ondrejtomcik
Copy link

@at-wat AFAIK WASM will never support direct access to TCP/UDP socket as it's still running in the sandbox of the browser. At least that's my understanding. Am I wrong?
I am asking because I am using pion/DTLS, would like to use it in a web assembly, but I think this won't be ever supported. What do you think?

Thanks

@at-wat
Copy link
Member Author

at-wat commented May 11, 2021

@ondrejtomcik There is an open discussion about it: WebAssembly/design#1251
and at least not denied.

BTW, the issue title should be

-Enable tests for WASM once Go supports it
+Enable tests for WASM once WASM supports it

@at-wat at-wat changed the title Enable tests for WASM once Go supports it Enable tests for WASM once WASM supports it May 11, 2021
@ondrejtomcik
Copy link

I think it was answered, not sure why it's not closed.

This is not a limitation in WebAssembly, it is a limitation in the web browser itself: the browser only allows you to use HTTP(S), WebSockets, or WebRTC. It has no support for raw sockets (UDP or TCP).

@Sean-Der
Copy link
Member

Hey @ondrejtomcik

It may be possible to use pion/dtls in WASM! It just expects a net.Conn. You can make out this interface and have output just be buffers in/out.

If the library hardcodes UDP internally I would love to change that.

@ondrejtomcik
Copy link

@Sean-Der AFAIK it will be at the end translated only to websockets, so the other side will have to use websockets for communication.

@Sean-Der
Copy link
Member

Would you mind starting a demo repo and we could iterate there? So the goal is to create a WebSocket, but then have a DTLS connection over it?

I think we can make that happen!

@ondrejtomcik
Copy link

Sorry @Sean-Der, this is not what I am interested in. I hoped for being able to use native UDP in WASM but this doesn't seem to be possible.

@stv0g
Copy link
Member

stv0g commented Jan 20, 2023

If I am not mistaken, WASM tests have been added in the meanwhile:

https://github.com/pion/.goassets/blob/master/.github/workflows/test-wasm.reusable.yml

@at-wat Can you confirm, so this issue can be closed?

@at-wat
Copy link
Member Author

at-wat commented Jan 21, 2023

My original thoughts was to remove //go:build !js in all tests.
It will be possible once WASI Sockets proposal is implemented and Go WASM supports WASI syscall.

@stv0g
Copy link
Member

stv0g commented Jan 21, 2023

Cool :) But I think there is no more to do within the goassets repo to realize this?

The GitHub actions workflow is already setup?

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

4 participants