~nicohman/signal-rs

7e6d9d841383b6b5f4a6cb10ffb9cabf578777a2 — nicohman 11 months ago 8d4114c notif
Try notifications
3 files changed, 40 insertions(+), 3 deletions(-)

M Cargo.toml
M src/main.rs
A src/notification.rs
M Cargo.toml => Cargo.toml +7 -2
@@ 5,7 5,12 @@ authors = ["nicohman <nicohman@demenses.net>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[[bin]]
name = "main"
path = "src/main.rs"
[[bin]]
name = "notif"
path = "src/notification.rs"
[dependencies]
tungstenite = "0.11.0"
url = "2.1.0"


@@ 26,4 31,4 @@ gtk = "0.9"
once_cell = "^0"
pango = "0.9"
pangocairo = "^0"
cairo-rs = { version = "^0", features = ["png"] }
\ No newline at end of file
cairo-rs = { version = "^0", features = ["png"] }

M src/main.rs => src/main.rs +0 -1
@@ 25,7 25,6 @@ use glib::clone;
use gtk::prelude::*;
use gtk::*;
use signal::*;
use std::borrow::*;
use std::collections::*;
use std::env::args;
use std::rc::*;

A src/notification.rs => src/notification.rs +33 -0
@@ 0,0 1,33 @@
mod signal;
use signal::*;
use tokio_tungstenite::*;
use gio::prelude::*;
use glib::clone;
use gtk::prelude::*;
use gtk::*;
use signal::*;
use std::collections::*;
use std::env::args;
use std::rc::*;
use tungstenite::*;
use url::Url;
use futures_util::StreamExt;
use tokio::sync::mpsc::*;
const CONNECTION: &str = "ws://localhost:9080/ws";

#[tokio::main]
async fn main() -> Result<()> {
    let _total: Vec<SignalResponse> = vec![];
            let (socket, _response) = connect_async(Url::parse(CONNECTION).unwrap())
                .await
                .unwrap();
            let mut session = SignalSession::from_socket(socket);
            loop {
                tokio::select! {
                    next = session.stream.next() => {
                        println!("{:?}", next);
                    },
                };
            }
    Ok(())
}