3 ms·
If it really runs inside the Browser: How did they implement adapters for networking and crypto/tls? I mean, a console is nice and all. But I'm highly sceptic
by cookiengineer 5y ago
If it really runs inside the Browser: How did they implement adapters for networking and crypto/tls?
I mean, a console is nice and all. But I'm highly sceptic as to how the filesystem and networking works, because fetch cannot be used to have dgram or tls/net sockets. And that is literally the primary reason nodejs exists.
- scoopertrooper 5y agoPart of the answer to your question: > WebContainers include a virtualized TCP network stack that's mapped to your browser's ServiceWorker API, enabling you to instantly create live Node.js servers on-demand that continue to work even when you go offline.
- cookiengineer 5y agoI was trying to refer to the simulated iframe that's the live preview...and probably uses the service worker's responses to emulate the behaviour rather than say, a real end-to-end http server pipeline. This sounds very likely like http module injection, so that the nodejs module isn't really doing what it thinks it does, but is using an injected API behind the scenes. Raw TCP is only available for Chrome Extensions, on Chrome OS, iirc. (Setting aside the lack of TLS or a real crypto module that isn't using the Browser's Web Crypto API approach)