ESPTerm implements commands for device-to-device messaging and for requesting external servers. This can be used e.g. for remote control, status reporting or data upload / download.
Networking commands use the format `\e^...\a`, a Privacy Message (PM). PM is similar to OSC, which uses `]` in place of `^`. The PM payload (text between `\e^` and `\a`) must be shorter than 256 bytes, and should not contain any control characters (ASCII < 32).
To send a message to another ESPTerm module, use: `\e^M;DestIP;message\a`.
This command sends a POST request to `http://<DestIP>/api/v1/msg`. The IP address may be appended by a port, if needed (eg. :8080). In addition to POST, a GET request can also be used. In that case, any GET arguments (`/api/v1/msg?arguments`) will be used instead of the request body. This is intended for external access when sending POST requests is not convenient.
Each ESPTerm listens for such requests and relays them to UART: `\e^m;SrcIP;L=length;message\a`, with _length_ being the byte length of _message_, as ASCII.
Notice a pattern with the first letter: capital is always a command, lower case a response. This is followed with the HTTP commands and any networking commands added in the future.
*Example:* Node 192.168.0.10 sends a message to 192.168.0.19: `\e^M;192.168.0.19;Hello\a`. Node 192.168.0.19 receives `\e^m;192.168.0.10;L=5;Hello\a` on the UART. Note that the IP address in the reception message is that of the first node, thus it can be used to send a message back.
To request an external server, use `\e^H;method;options;url\nbody\a`.
The response has the following format: `\e^h;status;options;response\a`
*Example:* `\e^H;GET;B;http://wtfismyip.com/text\a` - get the body of a web page (wtfismyip.com is a service that sends back your IP address). A response could be `\e^h;200;B,L=11;80.70.60.50\a`.