#realtime #websocket #pusher

pusher-beam-rust

Pusher BEAMS support for rust

3 releases

0.1.3 Oct 19, 2020
0.1.2 Oct 19, 2020
0.1.1 Oct 19, 2020
0.1.0 Oct 18, 2020

#162 in WebSocket

MIT license

5KB
68 lines

Pusher

Pusher BEAMS support. See: https://pusher.com/docs/beams.

Example:

    let instance_id = env::var("PUSHER_BEAM_INSTANCE_ID").unwrap();
    let secret = env::var("PUSHER_BEAM_SECRET").unwrap();
    let pusher = PusherBeam::new(&instance_id, &secret);
    let request = r#"
    {"web":{"notification":{"title":"Hello","body":"Hello, world!"}}}
    "#;
    let payload = Payload {
        interests: vec!["hello".to_owned(), "hi".to_owned()],
        web: serde_json::from_str(request)?,
        fcm: Value::Null,
        apns: Value::Null,
    };
    pusher.publish(&payload).await.unwrap();

Dependencies

~3.5–7.5MB
~186K SLoC