# Ultimate Chat Client - Protocol This README explains in details how the protocol works for the chat client and how to use it to build your own client. This chat client is just a joke, and a gibberish bodge using encrypted JSON messages over MQTT. ## Packets All packets have the same default headers for sending and receiving packets. The header should be described as following: ```json5 { "type": "message", // the packet type "from": "username", // the username of the sender "timestamp": 1615212625000 // unix timestamp (UTC) in millis of when the packet was sent } ``` **Packet send message** Available content types are: cowsay, ponysay cowsay and ponysay requires the content-icon tag to specify the icon for the message. ```json5 { "header": { "type": "message", "from": "username", "timestamp": 1615212625000, }, "message-id": "9c054a90-2905-474b-b688-c70b07b8f790", // the id of the message to identify it "content-type": "cowsay", // the message type - look at available content types below "content-icon": "tux", // icon for the message if the type is cowsay or ponysay "content": "your message here", // the content of the message that is sent - needs to correspond with the type } ``` **Packet request messages** ```json5 { "header": { "type": "request", "from": "username", "timestamp": 1615212625000 }, "length": 420, // the amount of messages requested back in time } ```