gpt4 book ai didi

html - 如何在没有 webSockets 的情况下使用 QT WebChannel

转载 作者:太空宇宙 更新时间:2023-11-04 16:11:17 26 4
gpt4 key购买 nike

是否可以在没有 websockets 的情况下使用 QT QWebChannel,但使用 WebKit ICP?我只找到了使用 webSockets 的示例。

最佳答案

不幸的是,documentation指出:

It works on all browsers that support Qt WebSockets, [...]. Additionally, a custom transport mechanism can also be implemented using Qt WebSockets to support Qt WebChannel-based communication.

似乎没有 WebSockets 就无法使用它,这可以解释为什么您找到的所有示例实际上都在使用它们。

无论如何,它还声明:

The transport mechanism is supported out of the box by the two popular web engines, Qt WebKit 2 and Qt WebEngine (experimental).

尽管它是实验性的,但它看起来像是 WebSockets 的替代品。实际上,在深入研究链接文档时,我发现了 that page其中提到 WebKit 它在内部实现了所需的接口(interface),可以用来代替 WebSockets,但没有提供示例。

您可以在整个链接页面中找到备用信息,例如:

For HTML clients run inside Qt WebKit, you can load the file via qrc:///qtwebchannel/qwebchannel.js. For external clients you will need to copy the file to your webserver.

然后,根据我的理解,在这种情况下不使用 WebSocket,它会简要描述要在这些客户端上实现相同目标的步骤。

也就是说,在我看来,基于 WebSockets 的解决方案是建议的解决方案,因此您可能应该重新考虑您的架构并使用它们。否则,请准备好处理实验性和记录不佳的功能。

关于html - 如何在没有 webSockets 的情况下使用 QT WebChannel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34774940/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com