From 31f227e08fc3e593055478f6d191b0d00988441e Mon Sep 17 00:00:00 2001 From: Guilherme Castro Date: Fri, 26 Oct 2018 14:47:45 -0300 Subject: [PATCH] Add left and right whitespace trim for janus settings fields --- plugins/websocket-client/JanusWebsocketClientImpl.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/websocket-client/JanusWebsocketClientImpl.cpp b/plugins/websocket-client/JanusWebsocketClientImpl.cpp index 4f5b64d1b..fe41ad905 100644 --- a/plugins/websocket-client/JanusWebsocketClientImpl.cpp +++ b/plugins/websocket-client/JanusWebsocketClientImpl.cpp @@ -23,6 +23,14 @@ JanusWebsocketClientImpl::~JanusWebsocketClientImpl() bool JanusWebsocketClientImpl::connect(std::string url, std::string room, std::string username, std::string token, WebsocketClient::Listener* listener) { websocketpp::lib::error_code ec; + + url.erase(0, url.find_first_not_of(" \n\r\t")); + token.erase(0, token.find_first_not_of(" \n\r\t")); + room.erase(0, room.find_first_not_of(" \n\r\t")); + + url.erase(url.find_last_not_of(" \n\r\t")+1); + token.erase(token.find_last_not_of(" \n\r\t")+1); + room.erase(room.find_last_not_of(" \n\r\t")+1); //reset loggin flag logged = false; @@ -166,7 +174,6 @@ bool JanusWebsocketClientImpl::connect(std::string url, std::string room, std::s return ctx; }); //Create websocket connection and token -// std::string wss = url + "/?token=5f3293b2-7836-43f3-b4b4-598c68792be0&roomId=1c5c17ac-94ce-4e7e-83c7-e75f358016f9"; std::string wss = url + "/?token=" + token + "&roomId=" + room; //Get connection connection = client.get_connection(wss, ec);