Open at-wat opened 4 years ago
@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
@ondrejtomcik There is an open discussion about it: https://github.com/WebAssembly/design/issues/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
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).
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.
@Sean-Der AFAIK it will be at the end translated only to websockets, so the other side will have to use websockets for communication.
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!
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.
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?
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.
Cool :) But I think there is no more to do within the goassets repo to realize this?
The GitHub actions workflow is already setup?
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
.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: https://github.com/pion/.goassets/pull/4#issuecomment-573394065