allow communication between clients

This commit is contained in:
2025-04-17 18:50:00 -05:00
parent 24ab4a2f49
commit 9147787fd2
2 changed files with 8 additions and 3 deletions

View File

@@ -28,9 +28,12 @@ bool ChatServer::onEvent(const Archimedes::Event& event) {
std::cerr << "Server Recieved: " << s << std::endl;
static std::string res; res = "Server Recieved: " + s;
sm->sendReliable(e.msg->m_conn, res.c_str(), res.length());
for(auto& it : sm->getClients()) {
if(it.first != e.msg->m_conn)
sm->sendReliable(it.first, s.c_str(), s.length());
else
sm->sendReliable(e.msg->m_conn, "\nMessage sent\n", strlen("\nMessage sent\n"));
}
return true;