Client WebSocket Echo

Mostra come scrivere una semplice applicazione client WebSocket.

Il client Echo illustra come utilizzare l'API WebSocket per inviare un messaggio a un server ed elaborare qualsiasi risposta restituita dal server; in questo caso, si limita a riportare la risposta.

Per impostazione predefinita, il client apre una connessione WebSocket a un server in ascolto sulla porta locale 1234. Quando il tentativo di connessione va a buon fine, il client invia un messaggio al server e visualizza qualsiasi risposta inviata dal server. Il client chiude quindi la connessione.

Client console Echo per WebSocket

A scopo illustrativo, utilizziamo il server WebSocket Echo, la cui risposta consiste semplicemente nel messaggio che è stato inviato.

Progetto di esempio su code.qt.io

Vedi anche WebSocket Echo Server.

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