4 ms·
Why would someone implement the chunk logic when websockets are here? Am I missing something? What are the use cases?
by pknerd 2y ago
Why would someone implement the chunk logic when websockets are here? Am I missing something? What are the use cases?
- blueflow 2y agochunked-encoding is a method of encoding an HTTP response body. The semantics for HTTP responses still apply, caching, compression, etc. Websocket is a different protocol that is started up via HTTP.
- rsynnott 2y agoHTTP/1.1 came out in 1997. It’s extremely well supported. Websockets were only standardised in 2011, and still have proxy traversal issues. You can absolutely assume that http 1.1 will work on basically anything; websockets are more finicky even now, and certainly were back in the day.
- masklinn 2y agoWebsockets are also on the far side of useless when it comes to streaming content the user is downloading. Javascript-filled pages are not the only clients of http.
- dylan604 2y ago> Javascript-filled pages are not the only clients of http. Whaaaaa??? We should eliminate these non-JS filled nonsense immediately!
- badmintonbaseba 2y agoIt wouldn't be so bad, if web and application APIs made stream processing of messages possible. The protocol itself could handle streaming content just fine, or at least not worse than HTTP.
- mannyv 2y agoWeb sockets have their own issues that can be/are implementation dependent. For example, some websocket servers don't pass back errors to the client (AWS). That makes it quite difficult to, say, retry on the client side. Chunked encoding is used by video players - so you can request X bytes of a video file. That means you don't have to download the whole file, and if the user closes the video you didn't waste bandwidth. There are likely more uses of it.
- floating-io 2y ago> Chunked encoding is used by video players - so you can request X bytes of a video file. That means you don't have to download the whole file, and if the user closes the video you didn't waste bandwidth. There are likely more uses of it. Just a nitpick, but what you describe here is byte range requests. They can be used with or without chunked encoding, which is a separate thing.
- mannyv 2y agoOh yeah, ugh - I get those two confused.
- david422 2y agoI would say rule of thumb, websockets are for two way realtime communication, http chunked is just for 1 way streaming communication.
- pknerd 2y agoWow. Downvoted