GithubHelp home page GithubHelp logo

pushover's Introduction

Pushover

License Crates.io Docs.rs

A Rust wrapper for the Pushover API (https://pushover.net/api).

Installation

Usage

Add the following to Cargo.toml:

[dependencies]
pushover = "0.4.0"

Synchronous example:

use pushover::API;
use pushover::requests::message::SendMessage;

fn send_message() {
    let api = API::new();

    let msg = SendMessage::new("token", "user_key", "hello");

    let response = api.send(&msg);
    println!("{:?}", response.expect("Error sending message"));
}

Asynchronous example:

use pushover::API;
use pushover::requests::message::SendMessage;

async fn send_message() {
    let api = API::new();

    let msg = SendMessage::new("token", "user_key", "hello");
    let response = api.send_async(&msg).await;

    println!("{:?}", response.expect("Error sending message"));
}

pushover's People

Contributors

sb89 avatar deliriouspenguin avatar

Stargazers

nsd avatar Sandalots avatar Sam Gutentag avatar  avatar Thomas Morgan avatar Dave Cottlehuber avatar Aleksander avatar

Watchers

 avatar

pushover's Issues

api.send waiting forever

Hello,

I used your library, however after a few successful notifications it seems to be stuck in epoll_wait forever. This is the stacktrace from the main thread:

#0  0x00007f1e18d6a8e3 in epoll_wait () from /lib64/libc.so.6
#1  0x0000555e0fb10b40 in mio::poll::Poll::poll::h9afd5815d242f782 ()
#2  0x0000555e0fb0a3a3 in tokio_core::reactor::Core::poll::had588b92cbdde165 ()
-- app main here

All the other threads (threads 2 to 5) end up in here:

#0  0x00007f1e1925a3ed in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x00007f1e19255d8b in _L_lock_812 () from /lib64/libpthread.so.0
#2  0x00007f1e19255c58 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3  0x0000555e0fafd0b8 in std::sys_common::backtrace::__rust_begin_short_backtrace::h31f4bea97a13caa6 ()
#4  0x0000555e0fafdea5 in std::panicking::try::do_call::h83d877622176c374 ()
#5  0x0000555e0fb3290d in panic_unwind::__rust_maybe_catch_panic () at /checkout/src/libpanic_unwind/lib.rs:99
#6  0x0000555e0fb0075d in _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h3fc6b8805221693d ()
#7  0x0000555e0fb2a8ec in call_once<(),()> () at /checkout/src/liballoc/boxed.rs:736
#8  start_thread () at /checkout/src/libstd/sys_common/thread.rs:24
#9  std::sys::imp::thread::{{impl}}::new::thread_start () at /checkout/src/libstd/sys/unix/thread.rs:90
#10 0x00007f1e19253de5 in start_thread () from /lib64/libpthread.so.0
#11 0x00007f1e18d6a30d in clone () from /lib64/libc.so.6

My code it really simple, I'm basically trying to send a message in a loop with API created outside of it.

    let api = SyncAPI::new().expect("Error creating API");
    
    loop {
        // some work here ...
        if it_happened {
            let mut msg = SendMessage::new("token", "key", "msg");
            msg.set_title("title");
            msg.set_priority(Priority::Normal);
            msg.set_sound(Sound::CashRegister);

            println!("this appears");
            let response = api.send(&msg);
            println!("this does not");
        }
    }

Is this a known issue?

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.