feat: add heartbeat capability

This commit is contained in:
Mudit Vats
2021-03-23 14:00:49 -07:00
parent 5b5a480943
commit a8e1bc89f0
5 changed files with 80 additions and 1 deletions

View File

@@ -11,6 +11,7 @@
#include "lms.h"
#include "commands.h"
#include "activation.h"
#include "heartbeat.h"
#include "utils.h"
#include "usage.h"
#include "args.h"
@@ -246,6 +247,21 @@ int main(int argc, char* argv[])
return;
}
if (msgMethod.compare("heartbeat_request") == 0)
{
// create the response
std::string response;
if (!heartbeat_create_response(response)) return;
// send it
web::websockets::client::websocket_outgoing_message send_websocket_msg;
std::string send_websocket_buffer(response);
send_websocket_msg.set_utf8_message(send_websocket_buffer);
client.send(send_websocket_msg).wait();
return;
}
// process any messages we can
// - if success, done
// - if error, get out