Add support for JSON-RPC subscriptions.

This commit is contained in:
Arthur Britto
2012-12-29 16:07:29 -08:00
parent e91ce698f6
commit ab0da033c3
6 changed files with 154 additions and 63 deletions

View File

@@ -1,20 +1,37 @@
#ifndef __RPCSUB__
#define __RPCSUB__
#include <deque>
#include "../json/value.h"
#include "NetworkOPs.h"
#define RPC_EVENT_QUEUE_MAX 32
// Subscription object for JSON-RPC
class RPCSub : public InfoSub
{
std::string mUrl;
std::string mIp;
int mPort;
std::string mUsername;
std::string mPassword;
std::string mUrl;
std::string mIp;
int mPort;
std::string mUsername;
std::string mPassword;
int mId; // Next id to allocate.
bool mSending; // Sending threead is active.
std::deque<std::pair<int, Json::Value> > mDeque;
protected:
void sendThread();
public:
RPCSub(const std::string& strUrl, const std::string& strUsername, const std::string& strPassword);
virtual ~RPCSub() { ; }
// Implement overridden functions from base class:
void send(const Json::Value& jvObj);