シンプルな WebSocket チャット

WebSocket プロトコルを使用した最小限のチャット・アプリケーションです。

このアプリケーションでは、QWebSocketQWebSocketServer クラスを使用して、WebSocket プロトコルを使用した最小限のチャットアプリケーションを作成する方法を示します。この例は、複数のクライアントが接続してメッセージを送受信できるサーバーです。

デフォルトでは、localhost ポート 1234 でリッスンします。接続されているすべてのクライアントを追跡し、クライアントの1つがサーバーにメッセージを送信するたびに、そのメッセージは他のすべてのクライアントに転送されます。クライアントが切断すると、クライアントのリストから削除される。

Simple WebSocket Chat HTML Client

サーバへの接続と切断、接続に関する問い合わせ、メッセージの送信、他のクライアントから送信されたすべてのメッセージの表示に使用されるHTMLクライアントもあります。

プロジェクト例 @ code.qt.io

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