Go to the documentation of this file.
7 #ifndef SIMPLECHATSERVER_H_
8 #define SIMPLECHATSERVER_H_
10 #include <Wt/WSignal.h>
11 #include <Wt/WString.h>
166 #endif // SIMPLECHATSERVER_H_
const Wt::WString formattedHTML(const Wt::WString &user, Wt::TextFormat format) const
Get the message formatted as HTML, rendered for the given user.
SimpleChatServer & operator=(const SimpleChatServer &)=delete
bool disconnect(Client *client)
Disconnect from the chat server.
ChatEventCallback eventCallback
const Wt::WString & message() const
Get the message of the event.
static const WString Empty
Encapsulate a chat event.
ChatEvent(const Wt::WString &user, const Wt::WString &message)
Type type() const
Get the event type.
ChatEvent(Type type, const Wt::WString &user, const Wt::WString &data=Wt::WString::Empty)
Type
Enumeration for the event type.
std::map< Client *, ClientInfo > ClientMap
SimpleChatServer(Wt::WServer &server)
Create a new chat server.
void sendMessage(const Wt::WString &user, const Wt::WString &message)
Send a message on behalve of a user.
UserSet users()
Get the users currently logged in.
std::function< void(const ChatEvent &)> ChatEventCallback
bool login(const Wt::WString &user)
Try to login with given user name.
bool connect(Client *client, const ChatEventCallback &handleEvent)
Connects to the chat server.
Wt::WString suggestGuest()
Get a suggestion for a guest user name.
bool changeName(const Wt::WString &user, const Wt::WString &newUser)
Changes the name.
const Wt::WString & data() const
Get the extra data for this event.
std::set< Wt::WString > UserSet
Typedef for a collection of user names.
void postChatEvent(const ChatEvent &event)
const Wt::WString & user() const
Get the user who caused the event.
void logout(const Wt::WString &user)
Logout from the server.
std::recursive_mutex mutex_
Generated on Fri Mar 20 2020 for the
C++ Web Toolkit (Wt) by
1.8.17