Simple WebSocket Chat

A minimal chat application using the WebSocket protocol.

This application shows how to use the QWebSocket and QWebSocketServer classes to create a minimalist chat application over the WebSocket protocol. The example is a server that allows multiple clients to connect to it to send and receive messages.

By default it listens at localhost port 1234. It keeps track of all clients that are connected to it, and each time one of the clients sends a message to the server, the message is forwarded to all other clients. When a client disconnects, it is removed from the list of clients.

Simple WebSocket Chat HTML Client

There is also an HTML-client that is used to connect to and disconnect from the server, query about the connection, send messages, and view all the messages sent by other clients.

Example project @ code.qt.io

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.