Esempio n. 1
0
void do_notify(pc_client_t *client) {
  const char *route = "connector.helloHandler.hello";
  json_t *msg = json_object();
  json_object_set(msg, "msg", json_string("hello"));

  pc_notify_t *notify = pc_notify_new();
  pc_notify(client, notify, route, msg, on_notified);
}
Esempio n. 2
0
int CCPomelo::notify(const char*route, json_t *msg, std::function<void(Node*, void*)> f)
{
    pc_notify_t *notify = pc_notify_new();
    notify_content[notify] = f;

    pc_notify(client,notify, route, msg, cc_pomelo_on_notify_cb);
    
    return 0;
}
Esempio n. 3
0
int CCPomelo::notify(const char*route,json_t *msg,CCObject* pTarget, SEL_CallFuncND pSelector){
    
    pc_notify_t *notify = pc_notify_new();
    CCPomeloContent_ *content = new CCPomeloContent_;
    content->pTarget = pTarget;
    content->pSelector = pSelector;
    notify_content[notify] = content;
    return pc_notify(client,notify, route, json_deep_copy(msg), cc_pomelo_on_notify_cb);
}
Esempio n. 4
0
void do_notify(pc_client_t *client) {
  // compose notify.
  const char *route = "connector.helloHandler.hello";
  json_t *msg = json_object();
  json_t *json_str = json_string("hello");
  json_object_set(msg, "msg", json_str);
  // decref json string
  json_decref(json_str);

  pc_notify_t *notify = pc_notify_new();
  pc_notify(client, notify, route, msg, on_notified);
}
Esempio n. 5
0
void NetImpl::do_notify( )
{
    // compose notify.
    const char* __route = "connector.entryHandler.hello";
    json_t* __msg = json_object();
    json_t* __json_str = json_string("hello");
    json_object_set(__msg, "msg", __json_str);
    // decref json string
    json_decref(__json_str);

    pc_notify_t* __notify = pc_notify_new();
    pc_notify(client_, __notify, __route, __msg, on_notified);

}
void Net::pomeloNotify(const char *route, const char *str)
{
	pc_notify_t *notify = pc_notify_new();
	json_error_t error;
	json_t *msg = json_loads(str, JSON_DECODE_ANY, &error);
	if(!msg)
	{
		pushMsg(std::string(route), std::string("{\"error\":true}"));
		pushMsg(std::string(PC_EVENT_REQUESTERR), std::string(""));
	}
	else
	{
		pc_notify(client, notify, route, msg, &Net::pomeloNotifyCallBack);
		//json_decref(msg);
	}
}