summaryrefslogtreecommitdiff
path: root/include/libsock/server
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-06-22 17:59:08 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-06-22 18:04:51 +0800
commit89a41052c9195c684e1eb035b4a556f986c321f3 (patch)
treee07c08abcb0a4c351ce30bc7ef59a624bc7684e6 /include/libsock/server
parentc76c01d1fd2ccbf91a6c3e0a120ed68c37ff106b (diff)
API!(server/clients:newClient): now returns a futuremain
Diffstat (limited to 'include/libsock/server')
-rw-r--r--include/libsock/server/clients.hpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/libsock/server/clients.hpp b/include/libsock/server/clients.hpp
index 4b67c23..2591cc3 100644
--- a/include/libsock/server/clients.hpp
+++ b/include/libsock/server/clients.hpp
@@ -7,6 +7,7 @@
#include <optional>
#include <string>
#include <thread>
+#include <future>
#include <vector>
namespace LibSock {
@@ -24,7 +25,7 @@ class Clients : public std::enable_shared_from_this<Clients> {
static SP<Clients> create(WP<Server> server);
~Clients();
- SP<Client> newClient(std::function<void(SP<Client> &)> cb = [](SP<Client>) {}, bool track = true, bool wait = false);
+ std::future<SP<Client>> newClient(std::function<void(SP<Client> &)> cb = [](SP<Client>) {}, bool track = true, bool wait = false);
void broadcast(const std::string &msg, std::optional<WP<Client>> self = std::nullopt); // second param only specified when we
// want to exclude the sender