WebSocketエコーサーバー

簡単な WebSocket サーバーアプリケーションの作成方法を紹介します。

このエコーサーバーは、WebSocketAPI を使用して、受信したメッセージに対して返信を返すシンプルなサーバーアプリケーションの作成方法を示しています。説明の便宜上、返信は単にメッセージのコピーとなっています。

お使いのウェブブラウザがWebSocketに対応している場合は、echoserver/echoclient.html{echoclient.html} ファイルを開き、次のスクリーンショットのように操作することもできます。

WebSocket エコー HTML クライアント

そうでない場合は、WebSocket Echo Clientを使用してサーバーに接続してください。

code.qt.io のサンプルプロジェクト

「WebSocket Echo Client」も参照してください 。

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