Simple lightweight concurrent state editing API using Tokio and websockets. There's a webpage example using react inside the webpage
directory, see more in Webpage example.
You can start the API by running cargo run
in your terminal!
The API currently uses the json-patch format, provided by the json-patch rust crate. Currently the API only supports merging but will support patch
operations in the future 😃 .
CEM will try to parse the payload into a Block
which consists of a json in the following format:
{
"id": "mylovellyid123",
"content": {
"time": 2, // => this is optional
...
}
}
Field | Description |
---|---|
id | unique to this block, will be used as key to update future blocks |
content | object containing data which will be updated |
time (unsigned 64 bits int) | if a block's time is less than the stored one, the block will be ignored |
After processing the message, CEM will broadcast to all connected users(except who updated) the updated block in the same Block
format.
- run
cargo install --path .
to install the API dependencies - access the webpage directory and run
npm install
to install the webpage dependencies
- Start the API by running
cargo run
in the root of the project - in another terminal window, access the webpage directory and run
npm start
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in CEM by you, shall be licensed as MIT, without any additional terms or conditions.