3 ms·
I don't understand something: "Cloudflare workers" are, at the end of the day, computers, right? Probably virtual ones (either VMs or containers). So, why is th
by danwee 3y ago
I don't understand something: "Cloudflare workers" are, at the end of the day, computers, right? Probably virtual ones (either VMs or containers). So, why is the ability of creating TCP sockets a feature? Why their "cloudflare workers" had that handicap to begin with?
- paulgb 3y agoThey are neither VMs or containers, but V8 Isolates. They lacked an API for making outgoing raw TCP connections in the same way that JavaScript running in a browser can’t.
- poxrud 3y agoThis used to be an option in Chrome when running in an extension. Sadly sockets were removed in manifest v3.
- silentsea90 3y agoI was lost about the distinction. This talk really helped: https://www.infoq.com/presentations/cloudflare-v8/ https://www.infoq.com/presentations/cloudflare-v8/
- zuprau 3y agoI might be wrong, but they're more like a browser’s "service worker" than a Node app.[0] The fact that they have to manually add "compatibility" with Node modules like `utils`[1] seems to support this. [0]: https://blog.cloudflare.com/node-js-support-cloudflare-workers/#supporting-native-apis https://blog.cloudflare.com/node-js-support-cloudflare-worke... [1]: https://blog.cloudflare.com/workers-node-js-asynclocalstorage/ https://blog.cloudflare.com/workers-node-js-asynclocalstorag...
- crabmusket 3y agoThat's exactly right, and they even use the same API[1] for accepting and replying to HTTP requests . As well as supporting other service worker APIs like caches. [1] https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent