美文网首页区块链学习笔记
The architecture of bitshares ap

The architecture of bitshares ap

作者: 杨小伟的世界 | 来源:发表于2018-08-07 16:55 被阅读0次

Local api call

The effect of following line. (fc/tests/api.cpp)

    fc::api<calculator> api_calc( std::make_shared<some_calculator>() );

    api<calculator>                                  some_calculator
    +----------------------+                         +----------------------+
    |_vtable               |  _vtable::visit_other(  |                      |
    |   +------------------+  vtable_copy_visitor()) |                      |
    |   | add       -------|------------------------>|add()                 |
    |   | sub       -------|------------------------>|sub()                 |
    |   |                  |                         |                      |
    |   |                  |                         |                      |
    |   |                  |                         |                      |
    +---+------------------+                         +----------------------+

RPC

  • Client:
  1. auto apic = std::make_shared<websocket_api_connection>(*con, MAX_DEPTH);
  2. auto remote_login_api = apic->get_remote_api<login_api>();
  3. auto remote_calc = remote_login_api->get_calc();
  • Server:
  1. auto wsc = std::make_shared<websocket_api_connection>(*c, MAX_DEPTH);
  2. auto login = std::make_shared<login_api>();
  3. login->calc = calc_api;
  4. wsc->register_api(fc::api<login_api>(login));

相关文章

网友评论

    本文标题:The architecture of bitshares ap

    本文链接:https://www.haomeiwen.com/subject/vhuavftx.html