Skip to main content
Notifications tell an agent when a file or directory changes in the virtual filesystem: a teammate edits a report in Box, and the agent gets update /box/report.csv.
  1. The application receives a change from the service, or asks it for one.
  2. It reports the change with ws.notify(), which also drops Mirage’s cached copy of that path.
  3. The agent receives it from ws.events().
ws.events() alone watches nothing: the application connects the service, by push or poll.

Listen for changes

Push

The service sends each change: a webhook, a stream or a file watcher. A hook turns its payload into changes for ws.notify():

Poll

The VFS asks the service what changed since a checkpoint. The first pull, with no checkpoint, returns none and records where to start:
Any other VFS: the application detects the change itself and calls ws.notify().

Examples

The Disk example edits files behind Mirage, reports each change, and reads again:
The S3 and GitHub examples read a saved payload and start no webhook server. Dropbox waits on a long poll; Box and Google Drive check every five seconds until Ctrl-C.