WebSocket Echo 服务器

演示如何编写一个简单的 WebSocket 服务器应用程序。

此 Echo Server 演示了如何使用WebSocketAPI 创建一个简单的服务器应用程序,该应用程序可在收到消息后发送回复。为了便于说明,回复只是消息的副本。

如果你的网络浏览器支持WebSocket,你也可以用它打开echoserver/echoclient.html{echoclient.html} 文件,并按以下截图所示进行操作:

WebSocket Echo HTML 客户端

否则,请使用WebSocket Echo Client连接服务器。

示例项目 @ code.qt.io

另请参阅 WebSocket Echo Client

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