@ -5,6 +5,263 @@ fuse-wsfs combines libwebsockets and libfuse. It allows ot attach a remote files
**Status**: Proof of concept
**Status**: Proof of concept
***Latest Build on travis***: [https://travis-ci.com/falk-werner/fuse-wsfs](https://travis-ci.com/falk-werner/fuse-wsfs)
***Latest Build on travis***: [https://travis-ci.com/falk-werner/fuse-wsfs](https://travis-ci.com/falk-werner/fuse-wsfs)
# Workflow an API
+---------------------+ +-------------+ +------+
| Filesystem Provider | | wsfs daemon | | user |
| (e.g. Webbrowser) | | | | |
+----------+----------+ +------+------+ +---+--+
| | |
| +-+-+ |
| | +--+ |
| | | | fuse_mount |
| | +<-+|
| | | |
| | +--+ |
| | | | start ws |
| | +<-+|
| +-+-+ |
| | |
+-+-+ connect +-+-+ |
| |--------------->| | |
+-+-+ +-+-+ |
| | |
| +-+-+ ls +-+-+
+-+-+ readdir | |<------------+|
| |<---------------+|||
| | | | | |
| | readdir_resp | | | |
| +--------------->| | [., ..] | |
+-+-+ | +------------>| |
| +-+-+ +-+-+
| | |
With fuse-wsfs it is possible to implement remote filesystems based on websockets.
A reference implementation of such a daemon is provided within the examples. The picture above describes the workflow:
- The websocket filesystem daemon (*wsfs daemon*) mounts a filesystem on startup.
It starts the websocket server and waits for incoming connections.
- A remote filesystem provider connects to wsfs daemon via websocket protocol.
The example includes such a provider implemented in HTML and JavaScript.
- Whenever the user makes filesystem requests, such as *ls*, the request is redirected via wsfs daemon to the connected filesystem provider
Currently all requests are initiated by wsfs daemon and responded by filesystem provider. This may change in future, e.g. when authentication is supported.
## Requests, responses and notifications
There are three types of messages, used for communication between wsfs daemon and filesystem provider. All message types are encoded in [JSON](https://www.json.org/) and strongly inspired by [JSON-RPC](https://www.jsonrpc.org/).
### Request
A request is used by a sender to invoke a method on the receiver. The sender awaits a response from the receiver. Since requests and responses can be sendet or answered in any order, an id is provided in each request to identify it.