Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Why would you want to upload a file through websockets anyway?


sort by: page size:

Hello, guys. For the sake of curiosity, why do you not use Websockets?

Because you can't use WebSockets in the browser without Javascript.

Why is it over a websocket? Can't it just share local data?

I made an upload tool that needed to handle very large files, and I used WebSockets to do it.

The strategy I used was to parse the MOV/MP4 locally, consider between 2-60 frames of data, hash it, then stream up the hashes to the server. Any hash the server didn't have got a reply to push those bytes.

The two-way nature of this dialog made WebSockets a good fit, although it certainly could have been emulated using other methods, it would have been much more code.


Why would you use this over web sockets?

I don't see the point of websockets, why not just let the browser make normal outbound TCP connections?

Because it handles the WebSocket protocol for you.

One thing that I've never understood is why websockets instead of server sent events?

Websockets are for browser clients, there's no much choice there unfortunately.

That's because WebSockets are more or less just sockets for web apps. You'lll want to use a protocol that deals with messages and their at-least-once delivery, such as MQTT (that can run on top of WebSocket if you need it).

Websockets are the natural choice when/if we bring Filmgrain to the browser. I actually think Websockets are really exciting, but for a mobile app just going straight socket made more sense.

It actually doesn't use WebSockets, media is sent browser-to-browser over UDP. This has the benefit of low latency.

Why are websockets only useful to talk to servers? Why wouldn't the be good for p2p?

And the first thing that people do when they start using websockets is to define a message layer.

HTTP is designed for transferring media types. It can transfer the application/octet-stream if you want to transfer "raw" binary.

If want you want to do is stream binary data, there are better protocols than TCP or UDP for the purpose. The use of Websockets is a way to get binary streams through the HTTP "firewall hole" on port 80/443, not because it is more efficient.


Genuinely curious coz I don’t understand mobile networks very well — why not just send frames over websockets? You still get a persistent TCP connection and there’s no need for pushing or polling of any kind.

What is the benefit of this over WebSockets? More generally, what is it even, and what problems does it solve?

Websockets serve entirely different purposes.

If it can't be hosted on the crappiest major shared host provider you could name, it isn't a fit for their goals.

Which means it's a total mystery why they're using WebSocket, but yeah.


WebSockets leverages TCP and is based on/compatible with HTTP. Nothing new about it, at least in the sense the article is discussing.
next

Legal | privacy