Example #1
0
void test_sub(client &c) {
    message_queue &q=c.subscribe({"abc", "def"});
    fiber pubber(test_pub);
    redis_message msg;
    q.pop(msg);
    assert(msg.first=="abc");
    assert(msg.second=="123");
    q.pop(msg);
    assert(msg.first=="def");
    assert(msg.second=="456");
    c.unsubscribe({"abc", "def"});
    this_fiber::sleep_for(std::chrono::seconds(1));
    assert(!q.is_open());
    pubber.join();
}