ndmspc v1.2.0-0.1.rc7
Loading...
Searching...
No Matches
NWsClientInfo.cxx
1#include "NWsClientInfo.h" // Include header from within its namespace
2
3namespace Ndmspc {
4
5// Default constructor implementation
7 : fWsId(0), fUsername(""), fMessageCount(0), fConnectedAt(std::chrono::system_clock::now())
8{
9}
10
11// Constructor with initial values implementation
12NWsClientInfo::NWsClientInfo(ULong_t id, const std::string & username)
13 : fWsId(id), fUsername(username), fMessageCount(0), fConnectedAt(std::chrono::system_clock::now())
14{
15}
16
17// Getters implementation
19{
20 return fWsId;
21}
22const std::string & NWsClientInfo::GetUsername() const
23{
24 return fUsername;
25}
27{
28 return fMessageCount;
29}
30
31std::chrono::system_clock::time_point NWsClientInfo::GetConnectedAt() const
32{
33 return fConnectedAt;
34}
35
36
37// Setter for username implementation
38void NWsClientInfo::SetUsername(const std::string & username)
39{
40 fUsername = username;
41}
42
43
44// Method to increment message count implementation
49
50
51} // namespace Ndmspc
std::string fUsername
Username associated with the client.
ULong_t GetWsId() const
Get the WebSocket client ID.
int GetMessageCount() const
Get the message count for the client.
NWsClientInfo()
Default constructor.
ULong_t fWsId
Unique WebSocket client ID.
std::chrono::system_clock::time_point GetConnectedAt() const
Get the connection start time for the client.
std::chrono::system_clock::time_point fConnectedAt
Connection start time.
const std::string & GetUsername() const
Get the username of the client.
void SetUsername(const std::string &username)
Set the username for the client.
int fMessageCount
Number of messages sent/received.
void IncrementMessageCount()
Increment the message count for the client.
Global callback function for libwebsockets client events.