QML WebSocket 服务器

一个简单的示例,演示如何使用 QML 中的 `WebSocketServer`。

QML WebSocket 服务器图形用户界面

本示例会打开一个窗口,其中包含一个监听传入连接的WebSocketServer ,以及一个连接至WebSocketServer 的 WebSocket。 每次点击窗口时,WebSocket 都会向WebSocketServer 发送一条消息。WebSocketServer 有一个信号处理程序,用于将收到的消息记录到窗口中并再次发送消息;而 WebSocket 也有一个信号处理程序,用于将返回的消息记录到窗口中。

示例项目 @ code.qt.io

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