ws snake (cobra simple server) add basic support for unsubscription + subscribe send the proper subscription data + redis client subscription can be cancelled

This commit is contained in:
Benjamin Sergeant
2019-09-05 20:27:01 -07:00
parent 5e94791b13
commit d8664f4988
8 changed files with 76 additions and 12 deletions

View File

@ -19,7 +19,7 @@ namespace ix
using OnRedisSubscribeResponseCallback = std::function<void(const std::string&)>;
using OnRedisSubscribeCallback = std::function<void(const std::string&)>;
RedisClient() = default;
RedisClient() : _stop(false) {}
~RedisClient() = default;
bool connect(const std::string& hostname, int port);
@ -32,9 +32,12 @@ namespace ix
const OnRedisSubscribeResponseCallback& responseCallback,
const OnRedisSubscribeCallback& callback);
bool stop();
private:
std::string writeString(const std::string& str);
std::shared_ptr<Socket> _socket;
std::atomic<bool> _stop;
};
} // namespace ix