Skip to content

Commit

Permalink
[#51747] documentation: Update documentation on management WebSocket
Browse files Browse the repository at this point in the history
  • Loading branch information
lkedziora committed Dec 6, 2023
1 parent 554e943 commit 7948cff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 2 additions & 1 deletion documentation/source/rdfm_mgmt_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export JWT_SECRET="THISISATESTDEVELOPMENTSECRET123"
poetry build && poetry install && poetry run python -m rdfm_mgmt_server --no-ssl --no-api-auth --local-package-dir ./packages/
```

This launches the RDFM Management Server with no encryption, listening on `localhost`/`127.0.0.1`. By default, the device communication socket is listening on port `1234`, while the HTTP API is exposed on port `5000`.
This launches the RDFM Management Server with no encryption, listening on `localhost`/`127.0.0.1`.
By default, the HTTP API is exposed on port `5000`.

When server is in debug mode (`app.run(debug=True, ...)` is set) every HTTP request received and response to it are printed to STDOUT.

Expand Down
16 changes: 7 additions & 9 deletions documentation/source/system_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,23 @@ in the [RDFM Server API Reference](api.rst) chapter. The clients use this API to

## Device-server RDFM Protocol

The devices also maintain a persistent connection to the RDFM Management Server by utilizing a custom JSON-based message protocol.
The devices also maintain a persistent connection to the RDFM Management Server by utilizing JSON-based messages sent over a WebSocket route.
This is used to securely expose additional management functionality without directly exposing device ports to the Internet.

Each message sent using the RDFM protocol is structured as follows:

```text
0 10 10+h
+---------+----------------------------+
| HEADER | utf-8 encoded JSON message |
+---------+----------------------------+
0 h
+----------------------------+
| utf-8 encoded JSON message |
+----------------------------+
```

The header is a 10-bytes UTF-8 encoded number representing the total length in bytes of the following message being sent.

The message is a UTF-8 encoded JSON object. Request and response messages are distinguished by the mandatory ``'method'`` field.
The message is a UTF-8 encoded JSON object, where each message is distinguished by the mandatory ``'method'`` field.

An example request sent to the server may look like:

``{'method': 'register', 'client': {'group': 'USER', 'name': 'testuser'}}``
``{'method': 'capability_report', 'capabilities': {'shell': True}}``

A response from the server may look like:

Expand Down

0 comments on commit 7948cff

Please sign in to comment.