summaryrefslogtreecommitdiff
path: root/include/libsock/server
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-06-22 16:14:17 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-06-22 16:14:17 +0800
commitb075eb7c98e45972b2ff79048cfde8f1469b00c7 (patch)
tree9958a14b1377a878cc4ba202dd4b25d2b7d3b9ac /include/libsock/server
parentb048a36cda2cf8359bf689c2e6825fc30d0277a5 (diff)
fix(server/clients): async initialization
API: newClient no longer take any args API: manual isValid() check is needed to interact with client now
Diffstat (limited to 'include/libsock/server')
-rw-r--r--include/libsock/server/client.hpp1
-rw-r--r--include/libsock/server/clients.hpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/include/libsock/server/client.hpp b/include/libsock/server/client.hpp
index 591bc2a..1d07837 100644
--- a/include/libsock/server/client.hpp
+++ b/include/libsock/server/client.hpp
@@ -48,6 +48,7 @@ class Client {
bool isValid();
private:
+ void init();
Client(SP<Server> server, SP<Clients> clients, bool track = false, bool oneShot = true);
WP<Client> m_self;
diff --git a/include/libsock/server/clients.hpp b/include/libsock/server/clients.hpp
index b18c043..dac5dd1 100644
--- a/include/libsock/server/clients.hpp
+++ b/include/libsock/server/clients.hpp
@@ -24,7 +24,7 @@ class Clients : public std::enable_shared_from_this<Clients> {
static SP<Clients> create(WP<Server> server);
~Clients();
- SP<Client> newClient(std::function<void(const WP<Client> &)> loopFunc = [](const WP<Client> &) { ; });
+ SP<Client> newClient();
void broadcast(const std::string &msg, std::optional<WP<Client>> self = std::nullopt); // second param only specified when we
// want to exclude the sender