Apollo 11.0
自动驾驶开放平台
apollo::dreamview::SocketManager类 参考

This is a major component of the Simulation backend, which manage all websockets to respond to all frontend request. 更多...

#include <socket_manager.h>

apollo::dreamview::SocketManager 的协作图:

Public 成员函数

 SocketManager (WebSocketHandler *websocket, UpdaterManager *updater_manager, DvPluginManager *dv_plugin_manager)
 Constructor of SocketManager.
 
void BrocastDataHandlerConf (bool clear_channel_msg=false)
 Broadcast data handler conf for all connections
 

详细描述

This is a major component of the Simulation backend, which manage all websockets to respond to all frontend request.

在文件 socket_manager.h 第 58 行定义.

构造及析构函数说明

◆ SocketManager()

apollo::dreamview::SocketManager::SocketManager ( WebSocketHandler *  websocket,
UpdaterManager *  updater_manager,
DvPluginManager *  dv_plugin_manager 
)

Constructor of SocketManager.

在文件 socket_manager.cc 第 40 行定义.

43 : enabled_(false),
44 websocket_(websocket),
45 updater_manager_(updater_manager),
46 dv_plugin_manager_(dv_plugin_manager) {
47 RegisterDataHandlers();
48 RegisterMessageHandlers();
49 auto channel_manager =
50 apollo::cyber::service_discovery::TopologyManager::Instance()
51 ->channel_manager();
52 auto topology_callback =
53 [this](const apollo::cyber::proto::ChangeMsg &change_msg) {
54 this->RefreshChannels(change_msg);
55 };
56 channel_manager->AddChangeListener(topology_callback);
57}

成员函数说明

◆ BrocastDataHandlerConf()

void apollo::dreamview::SocketManager::BrocastDataHandlerConf ( bool  clear_channel_msg = false)

Broadcast data handler conf for all connections

参数
clear_channel_msgtrue means broadcast data handler conf after clear channel msg.

在文件 socket_manager.cc 第 274 行定义.

274 {
275 Json response({});
276 response["data"] =
277 clear_channel_msg ? ClearDataHandlerChannelMsgs() : GetDataHandlerInfo();
278 response["action"] = "metadata";
279 websocket_->BroadcastData(response.dump());
280}
bool BroadcastData(const std::string &data, bool skippable=false)
Sends the provided data to all the connected clients.
nlohmann::json Json

该类的文档由以下文件生成: