meshtastic/website/docs/software/plugins/store-forward.md

123 lines
5.4 KiB
Markdown
Raw Normal View History

---
id: store-forward-plugin
2021-11-20 21:21:54 -08:00
title: Store and Forward plugin
sidebar_label: Store and Forward
---
## About
2021-04-13 12:18:52 -07:00
:::caution
This is a work in progress and is not yet available.
2021-04-13 11:13:57 -07:00
:::
The Store Forward Plugin is an implementation of a Store and Forward system to enable resilient messaging in the event that a client device is disconnected from the main network.
Because of the increased network traffic for this overhead, it's not adviced to use this if you are duty cycle limited for your airtime usage nor is it adviced to use this for SF12 (Long range but Slow).
## Requirements
Initial Requirements:
* Must be installed on a router node.
* * This is an artificial limitation, but is in place to enforce best practices.
* * Router nodes are intended to be always online. If this plugin misses any messages, the reliability of the stored messages will be reduced
* Esp32 Processor based device with external PSRAM. (tbeam v1.0 and tbeamv1.1, maybe others)
2021-11-20 21:21:54 -08:00
## Usage Overview
2021-11-20 21:21:54 -08:00
* To use / test this you will want at least 3 devices
* * One device will (currently) need be a tbeam v1.0 and tbeamv1.1 configured as a meshtastic router. Other devices with built in PSRAM will be supported at some point.
* * Two others will be regular clients. Nothing special required.
2021-11-20 21:21:54 -08:00
### Meshtastic channel configuration
2021-11-20 21:21:54 -08:00
Don't use this on the "Very long range (but slow)" or "Long range (but slower)" channel settings. You're welcome to try and report back, but those channels have a very low bitrate.
2021-11-20 21:21:54 -08:00
Either use a customer channel configuration with at an at least 1kbit data rate or use "Medium range (but fast)".
Recommended channel setting is for 1.343kbps:
```bash
meshtastic --setchan spread_factor 11 --setchan coding_rate 4 --setchan bandwidth 500
```
With an aftermarket coaxial antenna or moxon antenna, that will give you roughly the same range as "Long range (but slow)" and 5x the bitrate.
2021-11-20 21:21:54 -08:00
### Router setup
2021-11-20 21:21:54 -08:00
* Configure your device as a meshtastic router.
* * https://meshtastic.org/docs/software/settings/router
* Configure the Store and Forward plugin
* * Required configuration
* * * store_forward_plugin_enabled - Set this to true to enable the plugin. False to disable the plugin.
* * Optional configuration
* * * store_forward_plugin_records - Set this to the maximum number of records to save. Best to leave this at the default (0) where the plugin will use 2/3 of your device's available PSRAM. This is about 11,000 records.
* Name your router node something that makes it easily identifable, aka "Router".
2021-11-20 21:21:54 -08:00
Don't enable the Store and Forward plugin on multile routers!
2021-11-20 21:21:54 -08:00
### Client Usage
2021-11-22 18:29:06 -08:00
Currently, no sepcial configuration is required. To request your history sent to you, send the command into the message field "SF". That's it. This will eventually change to make it easier. At the moment, that message will be sent to everyone on the mesh but we'll (eventually) make it easier to use where there'll be a button (or maybe it'll be transparent) and the command isn't sent as a text message to the mesh.
Available Commands:
| Command | Definition |
| :-----: | :---------------: |
| SF | Send the last few messages I may have missed |
| SFm | Send a 240 byte payload (Used for testing) |
The Store and Forward plugin will only service one client at a time. If a second client requests messages while the S&F is busy, the S&F will send a private message to the second client that they will need to wait.
## Settings
| Setting | Acceptable Values | Default |
| :-----: | :---------------: | :-----: |
| store_forward_plugin_enabled | `true`, `false` | `false` |
| store_forward_plugin_records | integer | `0` |
| store_forward_plugin_replay_max_records (reserved) | integer | `0` |
| store_forward_plugin_replay_max_time (reserved) | integer | `0` |
## Developer TODO
2021-11-20 21:21:54 -08:00
Not necessarily in this order:
* Client Interface (Web, Android, Python or iOS when that happens) to request packets be resent.
* Router sends a heartbeat so the client knows there is a router in range.
* support for a mesh to have multiple routers that have the store & forward functionality (for redundancy)
* Add a default channel at about 1.5kbit / sec
* Eventually we could add a "want_store_and_forward" bit to MeshPacket and that could be nicer than whitelists in this plugin. Initially we'd only set that bit in text messages (and any other plugin messages that can cope with this). This change would be backward wire compatible so can add easily later.
* Have a "cool down" period to disallow a client to request the history too often.
* Message with SF status on requests.
* Be able to identify if you're within range of a router.
2021-11-21 09:31:51 -08:00
* Be able to specify the HOP MAX to reduce airtime. Is this necessary?
2021-11-21 09:31:51 -08:00
* Restrict operation of S&F on the slow channel configurations.
2021-11-21 09:31:51 -08:00
* Create a tx queue to prevent the history from being modified in flight.
* Only allow n-number of requests to the router at any one time.
* Set number of max messages from the history.
* Calculate a new channel with 250mhz bandwidth and ~1.5kbit.
*** Done
2021-11-21 09:31:51 -08:00
* Disable ACK. If the router is within range, so is the requester.
* Currently the way we allocate messages in the device code is super inefficient. It always allocates the worst case message size. Really we should dynamically allocate just the # of bytes we need. This would allow many more MeshPackets to be kept in RAM.
2021-11-21 09:31:51 -08:00
* Allow max history to be defined by radioConfig.preferences.store_forward_plugin_records
* Add a starting to send / finished sending message