-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
play is a time-consuming task, and calling this method blocks the reception of subsequent messages. How should this be handled?
uWS::Loop::get()->defer([this, ws]() {
this->play(ws);
});app->ws<PerSocketData>(api, {
.compression = uWS::DISABLED,
.maxPayloadLength = 1024 * 1024 * 1024,
.idleTimeout = 60,
.maxBackpressure = 1024 * 1024 * 1024,
.closeOnBackpressureLimit = false,
.resetIdleTimeoutOnSend = true,
.sendPingsAutomatically = true,
.upgrade = nullptr,
.open = [](uWS::WebSocket<false, true, PerSocketData> *ws) {
std::cout << "open..." << std::endl;
},
.message = [this](uWS::WebSocket<false, true, PerSocketData> *ws, std::string_view message,
uWS::OpCode opCode) {
try {
IMMsg msg = json::parse(message);
if(msg.getType() == "Video") {
std::string cmd = msg.getCmd();
if(cmd == "play") {
uWS::Loop::get()->defer([this, ws]() {
this->play(ws);
});
} else if(cmd == "stop") {
this->stop();
}
}
} catch (json::exception &e) {
LOGI << "Parsing message exception..." << e.what();
}
},Metadata
Metadata
Assignees
Labels
No labels