diff options
author | Michael Jurkoic <mjjurkoic@gmail.com> | 2024-03-17 19:15:29 -0500 |
---|---|---|
committer | Michael Jurkoic <mjjurkoic@gmail.com> | 2024-03-17 19:15:29 -0500 |
commit | 9832867f9ed9dbcc7ffbd135291bc54c153640b0 (patch) | |
tree | 903b0f36b5a3faf379a18f27692be878054b8cef /include/client | |
parent | c7096828e62fcea63120504b867150130377ab75 (diff) |
Define a receive method on the WebSocket interface
Diffstat (limited to 'include/client')
-rw-r--r-- | include/client/web_socket_client.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
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 <functional> #include <string> namespace client @@ -42,6 +43,14 @@ public: virtual std::tuple<std::string, bool> 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<void(const std::string&)> messageHandler) = 0; + + /** * @brief Closes the connection to the given server. */ virtual void closeConnection(std::string uri) = 0; |