From c3dd874a87f03082860b15269364950bb259c25e Mon Sep 17 00:00:00 2001 From: Klesti Selimaj Date: Thu, 19 Feb 2026 12:31:20 +0100 Subject: [PATCH] protocol --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index d64376b..6ec622d 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,29 @@ loop { .await; } ``` + +## Protocol + +#### Request + +The request `id` is separated from the peer, and will increment only on it's requests. + +```json +{ "type": "request", "id": 1, "method": "data", "data": "Hello from client" } +``` + +#### Response + +The response `id` **must** remain the same as the request. + +```json +{ "type": "response", "id": 1, "result": "Hello from server" } +``` + +#### Notifications + +A notification is a method that doesn't need validation or output, it simply notifies a peer for a specific information + +```json +{ "type": "notification", "result": "Hello from server" } +```