QWebChannelAbstractTransport Class

C++QWebChannel サーバーと HTML/JS クライアント間の通信チャネル。詳細...

Header: #include <QWebChannelAbstractTransport>
qmake: QT += webchannel
Inherits: QObject

パブリック関数

QWebChannelAbstractTransport(QObject *parent = nullptr)
virtual ~QWebChannelAbstractTransport() override

パブリック・スロット

virtual void sendMessage(const QJsonObject &message) = 0

シグナル

void messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport)

詳細説明

QWebChannel のユーザーは、このインターフェイスを実装し、QWebChannel に接続すべきすべてのクライアントに対して、QWebChannel サーバーにこのインターフェイスのインスタンスを接続しなければならない。Qt WebChannel スタンドアロンの例では、次のようにしてこれを行う方法を示している。 Qt WebSockets.

注: JSONメッセージプロトコルは内部的なものであり、時間の経過とともに変更される可能性がある。

Qt WebChannel Standalone Exampleも参照のこと

メンバー関数ドキュメント

[explicit] QWebChannelAbstractTransport::QWebChannelAbstractTransport(QObject *parent = nullptr)

与えられたparent でトランスポートオブジェクトを構築する。

[override virtual noexcept] QWebChannelAbstractTransport::~QWebChannelAbstractTransport()

トランスポートオブジェクトを破棄する。

[signal] void QWebChannelAbstractTransport::messageReceived(const QJsonObject &message, QWebChannelAbstractTransport *transport)

このシグナルは、リモートクライアントから新しいJSONmessagetransport 引数はこのトランスポートオブジェクトに設定されなければならない。

[pure virtual slot] void QWebChannelAbstractTransport::sendMessage(const QJsonObject &message)

JSONmessage をリモートクライアントに送信する。実装では、メッセージをシリアライズして、リモートのJavaScriptクライアントに送信します。

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