Comments (10)
This is with chrome 102, firefox 101, emcc 3.1.14, and datachannel-wasm 0.2.0
from datachannel-wasm.
looks like this only happens in datachannel-wasm 0.2.0, but I will test it properly tomorrow
from datachannel-wasm.
from datachannel-wasm.
According to this source: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createDataChannel
SyntaxError DOMException
Thrown if values were specified for both the maxPacketLifeTime and maxRetransmits options. You may specify a non-null value for only one of these.
But it's throwing this error when both values are null... is no one else encountering this behavior with their browser's implementation? I find it pretty weird
from datachannel-wasm.
I basically can't do pc->createDataChannel("label") on either chrome or firefox. I've looked into the javascript and it seems like this exception gets always thrown if both maxRetransmits and maxPacketLifeTime are in the datachannelInit, even if they're both null.
This is with chrome 102, firefox 101, emcc 3.1.14, and datachannel-wasm 0.2.0
I can't reproduce, on my side the Data Channel is created as expected.
Since the function prototype changed in #33, could it be possible your build mixes up different versions of JS and C++ code, which would result in garbage arguments being passed as maxPacketLifeTime
and maxRetransmits
? Could you please try rebuilding from scratch (i.e. after removing the entire build directory)?
After that I just get a ton of "Module.dynCall is not a function" errors. is there some emscripten flag I am supposed to toggle? I can't find any information about this "dynCall" thing...
Module.dynCall
allows to call a C function pointer from JavaScript. The emscripten option EXPORTED_RUNTIME_METHODS=['dynCall']
enabled by default in CMakeLists.txt should expose it.
from datachannel-wasm.
I do also get this warning when I'm compiling datachannel-wasm what indicates this may not be working:
em++: warning: linker setting ignored during compilation: 'EXPORTED_RUNTIME_METHODS' [-Wunused-command-line-argument]
from datachannel-wasm.
The warning means that it is a linker option so it has an effect only during linking and is ignored during compilation, while it is specified for both. I should move it to linking options only, but the option should work anyway.
from datachannel-wasm.
Just running the following javascript gives me the error in both chrome 102 and firefox 101:
pc = new RTCPeerConnection();
pc.createDataChannel("test",{
ordered: false,
maxPacketLifeTime: null,
maxRetransmits: null,
});
Firefox 101: Uncaught TypeError: Both maxPacketLifeTime and maxRetransmits cannot be provided
Chromium 102: Uncaught TypeError: Failed to execute 'createDataChannel' on 'RTCPeerConnection': RTCDataChannel cannot have both max retransmits and max lifetime
Removing either maxPacketLifeTime or maxRetransmits works fine:
pc = new RTCPeerConnection();
pc.createDataChannel("test",{
ordered: false,
maxPacketLifeTime: null,
});
Like I said earlier, I find this to be pretty strange as https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createDataChannel claims this should be a syntaxError and shouldn't even occur if one of the options is null. So perhaps it is a problem with (both!) of my browser's implementations?
It works for you right? May I ask what browser and version you are using?
from datachannel-wasm.
Looking at this mirror of the firefox source code:
https://github.com/bolucat/Firefox/blob/af1f896bdb514f1414b13c6edf224a4cc6d7e485/dom/media/PeerConnection.jsm#L1685
It appears that it checks if the parameters maxPacketLifeTime and maxRetransmits are undefined
, rather than null
.
Looking at chromium's source code:
https://chromium.googlesource.com/chromium/src/third_party/+/1b6aa2b5c4d9ef48255799dc6f4b4d16426c0207/blink/renderer/modules/peerconnection/rtc_peer_connection.cc#2665
It appears that it checks if they're greater than or equal to 0. I guess null is defined or cast to 0 within that context? Here is the definition of their RTCDataChannelInit struct:
Their use of unsigned short
seems to imply this. What do you think?
from datachannel-wasm.
Oh, I should have tested that first. My bad, it indeed doesn't work.
Thank you for the browser source code investigation, it looks like both browsers do not behave according to specifications as the W3C interface specification says the same thing as MDN: https://w3c.github.io/webrtc-pc/#dom-peerconnection-createdatachannel
Actually I can reproduce now, it appears I was testing with a submodule set on an incorrect version, sorry. I'm pushing a fix.
from datachannel-wasm.
Related Issues (20)
- suggestion about removing libdatachannel as a submodule HOT 2
- Usage of IceServer as a struct in Configuration HOT 1
- Concerns about Async operations HOT 4
- About using stringToUTF8 instead of allocUTF8FromString in webrtc.js and websocket.js HOT 2
- AS option? HOT 19
- onBufferedAmountLow is annoying HOT 11
- Missing rtc* functions during linking HOT 5
- how to use? can i use this in some embed v8 env to support wrtc? HOT 3
- Copy and Paste troubles HOT 5
- RuntimeError: Aborted(free() called but not included in the build - add '_free' to EXPORTED_FUNCTIONS) HOT 6
- ServiceWorker datachannel-wasm <=> window native datachannel HOT 3
- usecase HOT 3
- Nodejs support HOT 3
- datachannel-wasm with C based code HOT 4
- send Bytes over DataChannel HOT 3
- Align reliability API with the new API in libdatachannel
- Using Multithreading HOT 2
- support media transport HOT 1
- Match libdatachannel's reliability.hpp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datachannel-wasm.