-
Notifications
You must be signed in to change notification settings - Fork 114
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
data channel default binaryType value is 'blob' #2170
Comments
Although I generally find What do you think, @jesup? |
My biggest concern is that we would no longer be aligned with WebSocket.binaryType default value. |
The point of the overall design for the JS interface was to largely ducktype to WebSockets, so (other than setup code) you can substitute a DataChannel for a WebSocket. |
Good points raised. I reverse my earlier position. Firefox already implements the spec correctly, so I now think we should keep the spec as is, and have Chrome fix it. |
Closing the issue with no action then. |
I'd like the WG to revisit this. With Chromium not supporting this feature it seems they effectively default to " It seems highly unlikely Chromium and WebKit can transition away from that default to " |
Why is that? If one wants support in Firefox, one has to explicitly set it anyways which I'm That being said, my position hasn't changed since 2019. Everyone uses |
Good point!
Why is that? If I read it right it seems possible to negotiate ∞ using |
Exactly my point. |
Typically in situations like this the decision is made to side with the majority of implementers as that is likely to upset the least amount of web content. With implementers willing the WG can certainly decide to do something differently, but it's been many years now and not much happened. |
It is possible in SDP to ask for infinite message size. (FWIW, the limiting factor is the need to allocate a reassembly buffer, since all the pieces of the ArrayBuffer have to be assembled before giving it to the user in a single onmessage event.) (Parenthesis 2: If we really wanted to support infinite sizes, we should support an interface of stream, not blob - supporting blob means that instead of hitting the ceiling on the size of reassembly buffer, which occurs pretty frequently, we hit the ceiling on amount of RAM available, or, with disk-buffered blobs, amount of disk available. Those things will occur more rarely, and the code paths handling them will therefore be less tested.) |
The main goal is to get interop here. This seems to be more beneficial than WebSocket duck typing. Websites that do not set binaryType probably expect arrayBuffer and not blob in their vast majority (especially since Chromium is throwing when setting binaryType IIRC). We could try to look at some websites if that helps. @alvestrand, is there a plan for Chromium to implement blob support? |
See https://bugs.chromium.org/p/webrtc/issues/detail?id=2276 -- filed ten years ago (as of last week) |
As much as it pains me as the person who wrote most of the spec, 10 years of foot dragging has made this largely a moot point. The original design was quite reasonable and made sense at the time, especially since we envisioned being able to have applications based on WebSocket be easy to transition to DataChannels. WebTransport (once Safari supports it...) is a better replacement for WebSockets, though it is not API-compatible with WebSockets or DataChannels, and like WebSockets it's server-client only. DataChannels can be server-client, or peer-2-peer, so it provides important abilities the other 2 don't. It probably makes sense to change the default at this point. It is too bad Chrome didn't at least require a type of arraybuffer to be set instead of implementing a default different than the spec, but again, that's history now. If effort is going to be expended now to improve the API, it would be find ways to layer Streams on top of DataChannels. They weren't ready when this was designed over a decade ago. |
Let's change the defualt? |
This issue had an associated resolution in WebRTC December 5 2023 meeting – 05 December 2023 (Issue #2170 Data channel default binaryType value is 'blob'):
|
Default type changed to "arrayBuffer" by PR #2913 |
The default binaryType value is 'blob' in the spec.
Firefox implements it but Chrome and Safari uses 'arraybuffer'.
'arraybuffer' might be more convenient for web developers.
It could be promoted to the default value.
The text was updated successfully, but these errors were encountered: