doido-cable 0.0.16

Action Cable analogue: channels, broadcasts, Turbo-friendly pub/sub backends for Doido.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use doido_cable::CableFrame;

#[test]
fn client_frames_serialize_with_the_command_tag() {
    let frame = CableFrame::Subscribe {
        identifier: "ChatChannel".to_string(),
    };
    let json = frame.to_json().unwrap();
    assert!(json.contains(r#""command":"subscribe""#), "{json}");
    assert!(
        !json.contains(r#""type""#),
        "client frames use `command`, not `type`"
    );

    // and round-trips back
    assert_eq!(CableFrame::parse(&json).unwrap(), frame);
}