mirror of
https://git.sdf.org/epl692/tui-mqtt-chat.git
synced 2025-12-08 05:48:49 -05:00
This commit refactors the chat application to transmit MQTT messages using a structured JSON format. The struct, leveraging , now encapsulates both the username and the message content, allowing them to be sent and received as distinct fields. Key changes include: - Added and dependencies to . - Defined a struct with and fields. - Modified message publishing to serialize instances to JSON. - Updated message receiving to deserialize JSON payloads into instances. - Adjusted internal message storage and display logic to handle the separate username and message components. - Ensured the connect message also uses the new structured format.
15 lines
387 B
TOML
15 lines
387 B
TOML
[package]
|
|
name = "tui-mqtt-chat"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[dependencies]
|
|
ratatui = { version = "0.27.0", features = ["crossterm"] }
|
|
crossterm = { version = "0.27.0", features = ["event-stream"] }
|
|
rumqttc = "0.24.0"
|
|
tokio = { version = "1.38.0", features = ["full"] }
|
|
tokio-stream = "0.1.15"
|
|
rand = "0.8.5"
|
|
serde = { version = "1.0", features = ["derive"] }
|
|
serde_json = "1.0"
|