Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.51 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.51 KB

Rust Full Websocket Example

This is a boilerplate Rust Websocket Server with:

  • socket.io-like message format:
    {
      "event": "SOME_EVENT_NAME",
      "data"?: <ARBITRARY_DATA>
    }
  • JSON serialization / deserialization to / from structs with serde and serde_json
    • See msg_in.rs for a list of all incoming events
  • async / await event handlers with tokio-tungstenite
  • argument parsing with clap
  • logging with log and env_logger

To run:

cargo run

To test:

To modify:

  • Add your own incoming and outgoing messages to msg_in.rs and msg_out.rs respectively
  • Add your own message handlers to src/handler
  • Register message handlers in main.rs::handle_event
  • Add args in args.rs

Misc: