node-serviceworker
v0.3.0
Published
Environment for running serviceworkers in node.js, as 'isomorphic' request handlers for clients without SW support.
Downloads
19
Maintainers
Readme
node-serviceworker
Environment for running serviceworkers in node.js, as 'isomorphic' request handlers for clients without SW support.
Features and status
Based on this task.
- Registration to a scope. This introduces a very basic routing scope, but finer-grained routing is normally happening inside the service worker.
- fetch, via https://github.com/gwicke/node-fetch
- Added
ReadableStream
support. - This also provides a basic
Response
implementation, wrapping the node HTTP response object.
- Added
Request
wrapper for Node's IncomingMessage.- Cache. On the server, this is useful for in-process caching of frequently-used fragments.
- Accept
ReadableStream
body responses inFetchEvent.respondWith
- IndexedDB, via https://github.com/dumbmatter/fakeIndexedDB
- Runs basic sw-toolbox based ServiceWorkers.
- Periodic ServiceWorker code refreshs.
- Per-domain configuration support.
Demo
A demo service based on node-serviceworker-proxy is running at https://swproxy.wmflabs.org/wiki/Foobar. This is serving a demo streaming serviceworker, which composes templates and streamed HTML content using web-stream-util and web-html-stream.
TODO
- More closely implement
WorkerGlobalScope. Roughly in order of importance:
console
has a lot more methods in browsers than in nodelocation
: doneperformance
object: Lots missing.navigator
object: Partly done, but more to do.