diff --git a/src/ice/ice_transport.cpp b/src/ice/ice_transport.cpp index 11ff6a1..09f35bb 100644 --- a/src/ice/ice_transport.cpp +++ b/src/ice/ice_transport.cpp @@ -63,6 +63,8 @@ int IceTransport::InitIceTransport() { int IceTransport::InitIceTransport(std::string const &id) { transport_id_ = id; + ice_agent_ = new IceAgent(); + ice_agent_->CreateIceAgent( [](juice_agent_t *agent, juice_state_t state, void *user_ptr) { LOG_INFO("state_change: {}", ice_status[state]); diff --git a/tests/signal_client/signal_client.cpp b/tests/signal_client/signal_client.cpp deleted file mode 100644 index aeac770..0000000 --- a/tests/signal_client/signal_client.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "ws_client.h" - -#include -#include -#include -#include - -class WsReceiver:public WsCore -{ -public: - WsReceiver(){} - ~WsReceiver(){} - - void OnReceiveMessage(const std::string &msg) - { - LOG_INFO("Receive msg: {}", msg); - } -}; - -int main() -{ - bool done = false; - std::string input; - WsReceiver ws_client; - - LOG_INFO("connect ws://localhost:9002"); - ws_client.Connect("ws://localhost:9002"); - - std::string status1 = ws_client.GetStatus(); - - while("Open" != status1) - { - status1 = ws_client.GetStatus(); - } - - LOG_INFO("Connect successfully!"); - - LOG_INFO("Send message [Hello]"); - ws_client.Send("Hello"); - - LOG_INFO("Send ping"); - ws_client.Ping(); - - LOG_INFO("Close conneciton"); - int close_code = websocketpp::close::status::normal; - std::string reason = "User Close"; - ws_client.Close(close_code, reason); - - getchar(); - return 0; -} \ No newline at end of file diff --git a/xmake.lua b/xmake.lua index 19de16f..0ec30ed 100644 --- a/xmake.lua +++ b/xmake.lua @@ -14,10 +14,10 @@ add_defines("ASIO_STANDALONE", "ASIO_HAS_STD_TYPE_TRAITS", "ASIO_HAS_STD_SHARED_ "ASIO_HAS_STD_ADDRESSOF", "ASIO_HAS_STD_ATOMIC", "ASIO_HAS_STD_CHRONO", "ASIO_HAS_CSTDINT", "ASIO_HAS_STD_ARRAY", "ASIO_HAS_STD_SYSTEM_ERROR") -if is_plat("windows") then +if is_os("windows") then add_defines("_WEBSOCKETPP_CPP11_INTERNAL_") add_links("ws2_32", "Bcrypt") -elseif is_plat("linux") then +elseif is_os("linux") then add_links("pthread") set_config("cxxflags", "-fPIC") end @@ -73,13 +73,6 @@ target("signal_server") add_packages("asio", "nlohmann_json", "spdlog") add_includedirs("thirdparty/websocketpp/include") --- target("signal_client") --- set_kind("binary") --- add_deps("ws") --- add_files("tests/signal_client/signal_client.cpp") --- add_packages("asio") --- add_includedirs("src/ws", "thirdparty/websocketpp/include") - target("Offer") set_kind("binary") add_deps("projectx")