Hacker News new | ask | show | jobs
by soapdog 3244 days ago
Firefox OS had TCP[0] and UDP[1] sockets as Web APIs. They were quite pleasant to use as a developer and the only way to create a real mail client (needs TCP to implement POP, IMAP, SMTP in JS).

I wish more Firefox OS APIs had become web standards. They would allow for some very powerful PWAs.

[0]: https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/API/... [1]: https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/API/...

3 comments

> Firefox OS had TCP[0] and UDP[1] sockets as Web APIs. They were quite pleasant to use as a developer and the only way to create a real mail client (needs TCP to implement POP, IMAP, SMTP in JS).

The biggest problem with Firefox OS's TCP standard is that it used an event-driven model, which is somewhat at odds with more current promise-based thinking. The more natural version is to use something based on WHATWG Streams, but that spec has been stuck in vaporware-land for years.

> I wish more Firefox OS APIs had become web standards. They would allow for some very powerful PWAs.

The TCP specification actually was undergoing standardization (reformatted to use the streams API): https://www.w3.org/TR/tcp-udp-sockets/ . The problem was the working group ended up closing down, and since the specification wasn't suitable for use on webpages, it ended up with nobody to host it.

Those implementations were created to be utilised within FirefoxOS where applications are granted permissions by user when installing them. And access to several API would be strictly regulated by OS it self.

In Web context this approach wouldn't work and would lead to security issues. Just like there was need or WebSockets (TCP), there is need for similar API for UDP but it cannot be pure access for creating UDP connections as this leads to many security concerns.

I am a fan of the "just stick a security popup and let people choose" option but I understand that is not the same as having proper security.
Chrome OS supports the same thing: https://developer.chrome.com/apps/app_network

The SSH and mosh apps use a binding between the POSIX socket interface on the Native Client side and these APIs on the JS side.