fuse-wsfs combines libwebsockets and libfuse. It allows ot attach a remote filesystem via websockets.
fuse-wsfs combines libwebsockets and libfuse. It allows ot attach a remote filesystem via websockets.
# Contents
## Contents
- [Workflow and API](#Workflow-and-API)
- [Workflow and API](#Workflow-and-API)
- [Build and run](#Build-and-run)
- [Build and run](#Build-and-run)
- [Dependencies](#Dependencies)
- [Dependencies](#Dependencies)
# Workflow and API
## Workflow and API
+---------------------+ +-------------+ +------+
+---------------------+ +-------------+ +------+
| Filesystem Provider | | wsfs daemon | | user |
| Filesystem Provider | | wsfs daemon | | user |
@ -46,19 +46,19 @@ fuse-wsfs combines libwebsockets and libfuse. It allows ot attach a remote files
With fuse-wsfs it is possible to implement remote filesystems based on websockets.
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:
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.
- The websocket filesystem daemon (*wsfs daemon*) mounts a filesystem on startup.
It starts the websocket server and waits for incoming connections.
It starts the websocket server and waits for incoming connections.
- A remote filesystem provider connects to wsfs daemon via websocket protocol.
- A remote filesystem provider connects to wsfs daemon via websocket protocol.
The example includes such a provider implemented in HTML and JavaScript.
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
- 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.
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
### 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/).
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
#### 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.
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.
@ -74,11 +74,11 @@ A request is used by a sender to invoke a method on the receiver. The sender awa
| params | array | method specific parameters |
| params | array | method specific parameters |
| id | integer | id, which is repeated in response |
| id | integer | id, which is repeated in response |
### Response
#### Response
A response is used to answer a prior request. There are two kinds of responses:
A response is used to answer a prior request. There are two kinds of responses:
#### Successful Results
##### Successful Results
{
{
"result": <result>,
"result": <result>,
@ -90,7 +90,7 @@ A response is used to answer a prior request. There are two kinds of responses:
| result | any | request specific result |
| result | any | request specific result |
| id | integer | id, same as request |
| id | integer | id, same as request |
#### Error notifications
##### Error notifications
{
{
"error": {
"error": {
@ -104,7 +104,7 @@ A response is used to answer a prior request. There are two kinds of responses: