Note, you do not have JavaScript and this chat will have degraded functionality

Wt Chat client

This is a multi-user chat client and server.

To keep the example simple, server and clients all run in the same process. Still, because all I/O in Wt is asynchronous even when using "server push" which requires an open connection with each client at all times, clients do not tie up threads, and as such the application could easily support thousands of simultaneous users as well.

The client is contained in a widget (SimpleChatWidget), and can be instantiated as many times as you like, even in the same application.
Because of the widget abstraction, it is straight forward to include a chat client in your own application, by linking both the client and server classes into your application.

User name:

The implementation uses server-initiated updates, a feature that is not much different from regular client-server communication in Wt, and allows updating a session from outside its regular event loop. When a message is received, the user interface (i.e. widget tree) not only of the current session, but also of all other sessions is updated and "pushed" to these clients simultanously.