~nicohman/signal-rs

ref: notif signal-rs/src/notification.rs -rw-r--r-- 858 bytes
7e6d9d84 — nicohman Try notifications 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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(())
}