From 9832867f9ed9dbcc7ffbd135291bc54c153640b0 Mon Sep 17 00:00:00 2001 From: Michael Jurkoic Date: Sun, 17 Mar 2024 19:15:29 -0500 Subject: Define a receive method on the WebSocket interface --- include/client/web_socket_client.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/client/web_socket_client.hpp') diff --git a/include/client/web_socket_client.hpp b/include/client/web_socket_client.hpp index 0f58749..4e6cb8b 100644 --- a/include/client/web_socket_client.hpp +++ b/include/client/web_socket_client.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include namespace client @@ -41,6 +42,14 @@ public: */ virtual std::tuple send(std::string message, std::string uri) = 0; + /** + * @brief Sets up a message handler for the given server. + * @param uri The URI of the server to which the message handler should be attached. + * @param messageHandler A callable object that will be invoked when the client receives a + * message from the server. + */ + virtual void receive(std::string uri, std::function messageHandler) = 0; + /** * @brief Closes the connection to the given server. */ -- cgit