载入中...
搜索中...
未找到
eve::network::NetRpc类 参考
EVENGINE_API_PLATFORM public API. 更多...
#include <NetRpc.h>
Public 类型 | |
| using | Handler = std::function< void(NetReader &)> |
Public 成员函数 | |
| NetRpc (UdpLink *link) | |
| Net rpc. | |
| ~NetRpc () | |
| Net rpc. | |
| void | call (uint16_t msgId, const void *data, size_t n, bool reliable=true) |
| Call. | |
| bool | callString (uint16_t msgId, const std::string &payload, bool reliable=true) |
| Call string. | |
| void | registerHandler (uint16_t msgId, Handler h) |
| Registers handler. | |
| void | registerScript (uint16_t msgId, ssq::Object fn) |
| Registers script. | |
详细描述
EVENGINE_API_PLATFORM public API.
Lightweight RPC envelope over a UdpLink (or any link exposing the same message callback). Wire format: u16 msgId + payload bytes, sent on channel 0.
C++ handlers receive NetReader&; script handlers receive the raw payload as a Squirrel string (build a NetReader with eve.Network().newReader(bytes)).
成员类型定义说明
◆ Handler
| using eve::network::NetRpc::Handler = std::function<void(NetReader&)> |
构造及析构函数说明
◆ NetRpc()
|
explicit |
◆ ~NetRpc()
| eve::network::NetRpc::~NetRpc | ( | ) |
成员函数说明
◆ call()
| void eve::network::NetRpc::call | ( | uint16_t | msgId, |
| const void * | data, | ||
| size_t | n, | ||
| bool | reliable = true |
||
| ) |
Call.
在文件 NetRpc.cpp 第 42 行定义.
引用了 n, p, eve::network::UdpLink::Reliable, eve::network::UdpLink::send() , 以及 eve::network::UdpLink::Unreliable.
被这些函数引用 callString().
◆ callString()
| bool eve::network::NetRpc::callString | ( | uint16_t | msgId, |
| const std::string & | payload, | ||
| bool | reliable = true |
||
| ) |
◆ registerHandler()
| void eve::network::NetRpc::registerHandler | ( | uint16_t | msgId, |
| Handler | h | ||
| ) |
◆ registerScript()
| void eve::network::NetRpc::registerScript | ( | uint16_t | msgId, |
| ssq::Object | fn | ||
| ) |
Registers script.
Script-facing: stores a closure invoked with the payload string.
在文件 NetRpc.cpp 第 63 行定义.
引用了 fn.
该类的文档由以下文件生成:
- src/modules/network/NetRpc.h
- src/modules/network/NetRpc.cpp