Open Gozala opened 5 years ago
It's worth mentioning though that in SW context there is no self.postMessage
Is there anything in browsers for starting servers? Maybe copy whatever libdweb does?
We've used https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en in codelabs for running a webserver from Chrome, but it's not exactly a browser API.
That's a good idea, I think web extension style APIs would be OK.
I haven't had time to work on Webrun lately since I'm job hunting. But I'd be interested in vetting a PR if anyone wants to contribute this. 😀
While I absolutely dislike service worker API, it is somewhat similar to the https(s) server API. It might be worth considering exposeing
ServiceWorkerGlobalScope
compatible APIs notablyself.addEventListener('fetch', ...)
allowing it accept requests and respond.Although it's less clear how to one would start a server maybe something like ?
self.postMessage({ type: "http.listen", port: 8080 })