#phoenix #channel #client #serde-json

bin+lib phoenix-rs

Rust client for Phoenix channels

2 releases

Uses old Rust 2015

0.1.1 Jan 13, 2018
0.1.0 Jan 13, 2018

#18 in #phoenix

MIT license

12KB
298 lines

Phoenix Channels client for Rust

This library is an attempt to create Phoenix client in Rust. It is a work in progress so don't use it in production.

example

extern crate phoenix;
#[macro_use]
extern crate serde_json;

use phoenix::{Phoenix};

fn main() {
    let url = "wss://staging.haum.io/socket";
    let mut phoenix = Phoenix::new(url);
    let mutex_chan = phoenix.channel("device:6a:00:02:5a:ca:10").clone();

    {
        let mut device_chan = mutex_chan.lock().unwrap();
        device_chan.join();
        device_chan.send("get_home_id", json!({}));
    }

    loop {
        let msg = phoenix.out.recv().unwrap();
        println!("{:?}", msg);
    }
}

Dependencies

~6.5MB
~156K SLoC