update.
Some checks failed
Deploy / Build (push) Failing after 1m22s

This commit is contained in:
luocai
2025-05-14 17:14:33 +08:00
parent 836c8e0c44
commit 71485e7975
24 changed files with 122 additions and 95 deletions

View File

@ -1,23 +1,28 @@
#include "SignalServer.h"
#include "../Application.h"
#include "../HttpSession.h"
#include "Base/HttpSession.h"
#include "Base/Messages.h"
#include "Core/Logger.h"
#include "Core/Singleton.h"
#include "WebSocketSignalSession.h"
#include <boost/beast/websocket/rfc6455.hpp>
namespace Older {
SignalServer::SignalServer(Application &app) {
using namespace boost::urls;
using namespace Core;
// clang-format off
app.insertUrl("/api/v1/webrtc/signal/{id}", [this](HttpSession &session, const Application::Request &request, const matches &matches) {
auto id = matches.at("id");
if (boost::beast::websocket::is_upgrade(request)) {
auto ws = std::make_shared<WebSocketSignalSession>(session.releaseSocket(), *this, id);
ws->run(request);
} else {
LOG(error) << "webrtc client[" << id << "] not upgrade connection, request: " << std::endl << request;
}
});
auto manager = Singleton<MessageManager>::instance();
if (manager) {
manager->publish<RegisterUrlHandler>("/api/v1/webrtc/signal/{id}", [this](HttpSession &session, const HttpRequest &request, const matches &matches) {
auto id = matches.at("id");
if (boost::beast::websocket::is_upgrade(request)) {
auto ws = std::make_shared<WebSocketSignalSession>(session.releaseSocket(), *this, id);
ws->run(request);
} else {
LOG(error) << "webrtc client[" << id << "] not upgrade connection, request: " << std::endl << request;
}
});
}
// clang-format on
}