当我尝试使用 QWebChannel 将基于 QObject 的子类的实例发送到 html 客户端时,出现以下错误:
JSON 消息对象缺少 id 属性:{ "type": 3 }
服务端与客户端连接本身是成功的,只是对象无法发送。大概有人知道答案吗?
使用Qt WebChannel 独立示例重现并加载文件:///C:/Qt/5.5/Examples/Qt-5.5/webchannel/build-standalone-Desktop_Qt_5_5_0_MinGW_32bit-Debug/index.html?webChannelBaseUrl=ws://localhost: 12345运行 Qt 服务器后在您的 Web 浏览器中。