Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nora-soderlund/jsonmessages

A low effort, no time consuming, communication format for JSON objects for web messages.
https://github.com/nora-soderlund/jsonmessages

Last synced: 21 days ago
JSON representation

A low effort, no time consuming, communication format for JSON objects for web messages.

Awesome Lists containing this project

README

        

# JSON supported communication format
A low effort, no time consuming, communication format for JSON objects through for example internal APIs, web socket servers, etc.

## Manifests
1. At the start of a communication session (after the handshake): a manifest should be estabilished from the server connecting a key to a message header.
- A message’s header can range from 1 to 255^2.
2. The manifest should have a header of 0 if sent through this communication format.
3. Any message sent with a header byte not in the manifest will be ignored.

## Messages
1. The first byte of a message should be a star character (*).
2. The second and third byte should be the high and low bytes of the message header.
2. The fourth to last byte of a message should be the payload.
- The payload should contain the value of each property as defined in the message manifest, in the correct indexed order.
- Each property should not have a type identifier, such as quotations for strings. Each property is read raw.
- Each property should be seperated by a comma/pipe character.
- If a property contains a comma/pipe character, it should be suffixed with a backslash character to escape it.

## Example
```
*??Swedish,SV|English,EN|Danish,DK // 34 bytes
```
```js
[{"language":"Swedish","code":"SV"},{"language":"English","code":"EN"},{"language":"Danish","code":"DK"}] // 105 bytes
```
```json
[
{
"language": "Swedish",
"code": "SV"
},
{
"language": "English",
"code": "EN"
},
{
"language": "Danish",
"code": "DK"
}
]
```