-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Code:
void MarketDataThread::Start(std::string channel, std::string symbol)
{
uWS::Hub hub;
hub.onMessage([&](uWS::WebSocket<uWS::CLIENT> *ws, char *message, size_t length, uWS::OpCode opCode)
{
// Handle incoming message from WebSocket
std::string msg(message, length);
std::cout << "Received message: " << msg << std::endl; });
hub.onConnection([&](uWS::WebSocket<uWS::CLIENT> *ws, uWS::HttpRequest req)
{
std::cout << "onConnection." << std::endl;
hub.onDisconnection([&](uWS::WebSocket<uWS::SERVER> *ws, int code, char *message, size_t length)
{
std::cout << "onDisconnection." << std::endl;
});
// hub2.connect(*****, nullptr);
// 运行事件循环
hub.run();
}
void MarketDataThread::Stop()
{
// ???? HOW can I Do?
}
After I dynamically start the subscription in the thread, how do I stop the running of the uWS::Hub object in the stop? There is a uWS::Hub object in each thread. How do I implement it? thanks。
Metadata
Metadata
Assignees
Labels
No labels