Realm::Realm(QObject *parent) : WampBase(parent), d_ptr(new RealmPrivate()) { registerMethod(KEY_LIST_REGISTRATION_URIS, this, "registeredUris()"); registerMethod("wamp.registration.list", this, "registrationIds()"); registerMethod("wamp.registration.list_internal_uris", this, "registeredInternalUris()"); registerMethod("wamp.list_children_keys", this, "childrenKeys(QString)"); registerMethod("wamp.subscription.count_subscribers", this, "subscribersCount(QString)"); registerProcedure(KEY_GET_SUBSCRIPTION, [this](QVariantList args){//register some object qulonglong subscriptionId = (qulonglong)args[0].toDouble(); if(!this->d_ptr->_subscriptions.contains(subscriptionId)) { return WampResult(QVariant("wamp.error.no_such_subscription")); } WampRouterSubscriptionPointer subscription = this->d_ptr->_subscriptions[subscriptionId]; QVariantList resultArr; QVariantMap details; details["id"] = (double)subscription->subscriptionId(); details["created"] = subscription->created().toString("yyyy-mm-ddThh:mm:zzzZ"); details["uri"] = subscription->topic(); resultArr.append(details); return WampResult(QVariant(resultArr)); }); registerProcedure(KEY_LOOKUP_REGISTRATION, [this](QVariantList args){ QString uri = args[0].toString(); if(!this->d_ptr->_root.containsGenuine(uri)) return WampResult(); WampRouterRegistrationPointer registration = this->d_ptr->_root.findData(uri); return WampResult(QVariant(registration->registrationId())); }); }
void RpcServer::addService(const std::string& praefix, const ServiceRegistry& service) { std::vector<std::string> procs = service.getProcedureNames(); for (std::vector<std::string>::const_iterator it = procs.begin(); it != procs.end(); ++it) { registerProcedure(praefix + *it, service.getProcedure(*it)); } }
void RpcServer::addService(const std::string& domain, const ServiceRegistry& service) { std::vector<std::string> procs = service.getProcedureNames(); for (std::vector<std::string>::const_iterator it = procs.begin(); it != procs.end(); ++it) { registerProcedure(domain.empty() ? *it : (domain + '\0' + *it), service.getProcedure(*it)); } }
QString Cloud::debugInfo() const { QString info; info += QLatin1String("### Cloud: ###################\n"); if (!domain().isNull()) { info += QLatin1String("domain: #") + domain() + QLatin1String("#\n"); } if (port() != -1) { info += QLatin1String("port: #") + QString::number(port()) + QLatin1String("#\n"); } if (!path().isNull()) { info += QLatin1String("path: #") + path() + QLatin1String("#\n"); } if (!registerProcedure().isNull()) { info += QLatin1String("registerProcedure: #") + registerProcedure() + QLatin1String("#\n"); } if (!protocol().isNull()) { info += QLatin1String("protocol: #") + protocol() + QLatin1String("#\n"); } info += QLatin1String("### Cloud end ################\n"); return info; }