2 ms·
Websockets are implemented everywhere, though, to the point where they shouldn't have been (server side events are often a much better fit). Maybe your product
by jeroenhd 4y ago
Websockets are implemented everywhere, though, to the point where they shouldn't have been (server side events are often a much better fit).
Maybe your products don't use Websockets but the days of polling HTTP requests are long gone. Almost every web framework I know has some kind of support for websockets in its design and every proxy I know can easily handle websockets.
Sure, stuff like lambdas don't work but that's because the proprietary cloud provider API chooses not to implement them, probably for good reason. These types of programs are abstractions on top of abstractions, taking away all difficulty in multi server scaling at the cost of low level control over your code, and it turns out Websockets are just that: low level, stateful APIs that people wanted the browser to have.
The reason WebTransport is implemented is that people wanted UDP websockets. Unity developers have been asking for this stuff for years, for example, because running game logic over TCP out even QUIC can be terribly slow and stuttery. The websocket stack isn't really built for datagram exchange and support for the new feature depends on other factors (HTTP/3, for one) so I think it makes sense to make this a separate API. The mental model of what APIs are out aren't lossy is a lot clearer this way.
- klabb3 4y ago> The reason WebTransport is implemented is that people wanted UDP websockets. [...] because running game logic over TCP out even QUIC can be terribly slow and stuttery. Http/3 already uses quic so this is just using quic datagrams, which is sane.. But why not an extension to websockets (only available over http/3) when everything else is the same? EDIT: Got annoyed enough to look it up and I think this is the key: > While WebSockets starts as a HTTP/1.1 protocol, WebTransport works on top of several different protocols, including some that WebSockets doesn’t support. So apparently you have to start websockets over http/1.1 before upgrade which necessitates a separate connection per stream. Still, couldn't this be.. Fixed within the existing spec, or a major version bump? In either case, I guess it doesn't matter much, but I suspect a lot of people will be confused with the name.
- jeroenhd 4y agoYes, websockets follow an HTTP upgrade path and can't leverage datagrams. An breaking update in the HTTP spec would be quite painful, especially for backend libraries that are often updated only when absolutely necessary. The fact the API isn't even finished yet, let alone standardised, also makes it a good idea to add it as a new feature. I don't think browsers should mess with standardised protocols to implement some draft that's still in progress because they're very likely to break something, especially since this particular type of socket is only available to a small number of websites and use cases (those on servers supporting transferring raw HTTP/3 to the application server, so probably not most CDN/DDoS protection services).