예제 #1
0
	stock(cppcms::service &srv) : cppcms::application(srv),timer_(srv.get_io_service())
	{
		dispatcher().assign("^/price$",&stock::get,this);
		dispatcher().assign("^/update$",&stock::update,this);
		price_=10.3;
		counter_=0;
		async_run();
	}
예제 #2
0
파일: chat.cpp 프로젝트: dreamsxin/CppCMS
 chat(cppcms::service &srv) : 
     cppcms::application(srv)
 {
     queue_ = sse::bounded_event_queue::create(srv.get_io_service(),1024);
     queue_->enable_keep_alive(10);
     dispatcher().assign("/post",&chat::post,this);
     dispatcher().assign("/get",&chat::get,this);
     dispatcher().assign(".*",&chat::redirect,this);
 }
예제 #3
0
파일: rpc.cpp 프로젝트: floft/freetron
rpc::rpc(cppcms::service& srv, Database& db, Processor& p)
    : cppcms::rpc::json_rpc_server(srv), db(db), p(p),
      timer(srv.get_io_service()), exiting(false),
      statusThread(StatusThread(*this, exiting))
{
    // Account
    bind("account_login", cppcms::rpc::json_method(&rpc::account_login, this), method_role);
    bind("account_logout", cppcms::rpc::json_method(&rpc::account_logout, this), method_role);
    bind("account_create", cppcms::rpc::json_method(&rpc::account_create, this), method_role);
    bind("account_update", cppcms::rpc::json_method(&rpc::account_update, this), method_role);
    bind("account_delete", cppcms::rpc::json_method(&rpc::account_delete, this), method_role);

    // Forms
    bind("form_process", cppcms::rpc::json_method(&rpc::form_process, this), method_role);
    bind("form_getone", cppcms::rpc::json_method(&rpc::form_getone, this), method_role);
    bind("form_getall", cppcms::rpc::json_method(&rpc::form_getall, this), method_role);
    bind("form_delete", cppcms::rpc::json_method(&rpc::form_delete, this), method_role);
    bind("form_rename", cppcms::rpc::json_method(&rpc::form_rename, this), method_role);

    // Timeouts for getting rid of long requests
    on_timer(booster::system::error_code());
}