Secure WebSocket Echo Server

A simple server to respond to clients over secure WebSockets (wss).

The Secure WebSocket Echo Server example shows how to use the QWebSocketServer class to implement a simple echo server over secure sockets (wss). TLS support is required for this example to work. It authenticates itself to the client and, on success, can accept a message from the client, to which it responds. For the sake of illustration, its response is simply a copy of the message it was sent.

This server is configured with a self-signed certificate and key. Unless the clients contacting this server is configured to trust that certificate, which Secure WebSocket Echo Client does, they will reject this server.

Secure WebSocket Echo HTML Client

There is an HTML-based client as part of this example. But it will only work either if the browser used supports the certificate as described above, or if it ignores TLS errors for localhost addresses.

Example project @ code.qt.io

See also Secure WebSocket Echo Client and WebSocket Echo Server.

© 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.