| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch removes the obsolete API support to send raw messages using
a QWebChannel. Instead, it is encouraged to directly use WebSockets or
navigator.qt.
By doing so, we can cleanup the code considerably. While at it, the
transport API is adapted to work on QJsonObject messages, instead of
QStrings. This will allow us to use more efficient formats in e.g.
QtWebKit or QtWebEngine. One could also implement a JSONRPC interface
using a custom transport then.
Change-Id: Ia8c125a5558507b3cbecf128a46b19fdb013f47b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
|
|
|
|
|
|
|
| |
This fixes builds with Qt built without the widgets module.
Change-Id: I280b1443c3333d9d199d0b4fe7ee43bffb9c5e6e
Reviewed-by: Simo Fält <simo.falt@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The utility QWebChannelAbstractTransport implementation based on the
QtWebSocket has no big value. Instead, it would pull in the QtWebSocket
link-time dependency into QtWebKit/QtWebEngine, which is not desired.
Considering that the WebSocket usecase is minor, and only few people
will ever use it, we agreed that having the code in the example alone
is enough.
Change-Id: Ica038329a1d684f33e805fc296e9dff71b1446ba
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a quite big changeset, but necessary to get the roadmap
implemented that was discussed at QtCS.
With this patchset landed, the QWebChannel does not depend on
QtWebKit anymore, not even for the tests. Rather, we will introduce
the dependency in the other way (i.e. QtWebKit will optionally use
QtWebChannel if available).
For the pure Qt/C++ use-case, we ship a utility implementation of
a QWebChannelAbstractTransport that uses a QWebSocket for the
server-client communication. This way, we can get rid of the custom
WebSocket implementation.
The tests are refactored to run the qwebchannel.js code directly
inside QML. Integration tests for QtWebKit/QtWebEngine as well
as examples will be added to these repositories.
Change-Id: Icc1c1c5918ec46e31d5070937c14c4ca25a3e2d6
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
| |
The transport interface should outlive the web channel or unregister
itself before being destroyed.
Change-Id: I77eaa26a4e1985d83cc3f19d07830cf0ca48ee7c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This enables us to optionally use navigator.qt instead of a WebSocket,
which is nicer setup-wise and is also slightly faster:
navigator.qt:
284.0 msecs per iteration (total: 2,840, iterations: 10)
WebSocket:
295.8 msecs per iteration (total: 2,959, iterations: 10)
The baseline is ca. 203 msecs, which would mean a performance boost
of ca. 12.7%.
Furthermore, this sets the fundation to eventually add a WebEngine
transport mechanism. The WebViewTransport should also be removed and
instead the WebView itself should directly implement the
WebChannelTransportInterface.
Change-Id: I368bb27e38ffa2f17ffeb7f5ae695690f6f5ad21
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current CI system fails to build the webchannel when
QtWebKit is included in sync.profile, so we ignore it for now
and adapt the QMake build system to only include the declarative
tests when webkit is found.
As discussed with tronical, sifalt and sahumada, the qtqa scripts
will need to be adapted to cope with optional dependencies of non-qt5
modules.
Change-Id: Id89b763ef2697e9e72eb4064c150971b13ebccc3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
It depends on QtQuickControls for layouting of the QML server side
and uses an HTML page similar to the one used by the existing standalone
example.
The example itself uses the simple raw message passing and simulates a
chat app between QML server and HTML client.
Change-Id: Ib4ce39ca736febb82a7d56bef4501888b8c06bc7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
| |
I'll write new examples from scratch using the proper license.
Change-Id: If13e57cf8b19cf45178b6fccace59cb56410d84e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some tests referenced Nokia in their license even though that was never
the case. The tests where written completely by me after Qt Nokia times.
What is missing are the examples which are still mostly original work
by Noam back then in Nokia times. The rest was (re-)written by me
completely since then anyways.
Change-Id: Ib423fb3459bcc1f7464a02de4fd82ddfd614d282
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new registeredObjects list property is now preferred over the old
imparative registerObject/registerObjects API.
Items that are added to the list need an attached WebChannel.id property
which holds the identifier under which the object is published to remote
clients.
Change-Id: I96a8047b9a85e27f3fd48c900180c22ebd20eb35
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This is achieved by hiding the MetaObjectPublisher completely as
private API. The QWebChannel is the only publisher API and now handles
both the socket as well as the publisher internally.
This now allows us to create a proper QML api in the new QmlWebChannel.
Change-Id: I3096364af8485353ca9bc19df4a81a8e4552c3d7
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
| |
This fixes some regressions introduced by previous commits and ensures
that the examples work as intended. While at it, the code is cleaned up
a bit by using resources instead of referencing files in the source dir.
Change-Id: I01da305429dcdebcb96284b7110c59f3090b2201
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The code now resides in a single qwebchannel.js file and there is only
a single callback-nesting required to setup a MetaObjectPublisher
connection.
The server-side will be simplified in the next step.
Change-Id: Ib5fc77a03c2b281c61af91713411eed571ec6108
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
| |
When handling the destroyed signal of a QObject, the QMetaObject of the
sender() will point to the global static QObject meta object. Thus, we
also cache its signal argument types. This way, we are able to properly
handle the destroyed signal with minimum effort.
Change-Id: Iba1a3fc94d55adad178302cc847fd4285815e689
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This example shows how to use the (currently quite ugly) raw C++ API
to setup a webchannel without using QML at all. The HTML client is then
handled by the users default browser.
The example itself shows a simple chat between the HTML client and the
C++/Qt server, with a line edit for input and a text edit showing the
chat history.
Change-Id: I8baf14efb9d0c5f5880d99710cf6317fe9b887b9
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This module can hopefully be done in time for 5.3. This commit changes
the source structure and QMake files to adapt to typical Qt modules.
With this in place, we can now use QT += webchannel in qmake files to
link against the pure Qt/C++ QtWebChannel library.
The QML plugin is separated from it and can be loaded optionally, if
the quick module could be found. Also added is now a qmlplugindump
for tooling integration. Note that the Qt.labs namespace is removed.
The test file structure is also adapted to how its done in the
QtDeclarative module.
Note that this setup apparently does not support to run tests without
running make install first.
Change-Id: I1c15d72e7ab5f525d5a6f651f4e965ef86bc17bd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes a lot of obsolete files and simplifies the build system
of the examples.
Furthermore, the examples can now be run without running make install
first. It reuses the same import path as the test does.
Note that the examples are not installable anymore now though. If this
is required, it can be added again.
Change-Id: Ic7ff80f734b035a03fb1a11a2df492c97298ceff
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
|
|
|
|
|
| |
Change-Id: Ide09c6f218bf7af176e03e4741f29cd022f351b8
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
| |
This is required for factory-like methods on the C++/QML side,
which we want to access from the HTML side as well.
Change-Id: I2852bbc9c8effb6d6f49b5be784241a6e2320823
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: I0a640ee38d642670211b7cae30619fc18307b688
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a big code drop - sorry for that. The benefits are worth it
though, I'm sure. The optimizations were required to make the
WebChannel useable even on a low-end embedded device with medium
amount of traffic.
The changes in this patch can be grouped into different parts:
a) Do more in C++: Esp. by leveraging e.g. the new classInfoForObjects
in QtMetaObjectPublisher (on the C++ side) one can greatly reduce
the time required for initialization of the webchannel.
b) Property Caching: Instead of requiring a socket roundtrip whenever
a property is read on the HTML side, we now cache the property values
on the HTML side. Note that for this to work properly, one needs to
add proper notify signals to the property declarations, as otherwise
the cache will not get updated.
c) Grouping: Instead of sending separate messages to the clients
for every property update, these signals are grouped by a 50ms timer,
and then send aggregated to the client. This reduces the socket
traffic, as more boiler plate can be shared.
d) Compression: Some data was previously send repeatedly, such as
property name and notify signal. This is now compressed internally
where possible (i.e. for the ${propName}Changed naming scheme).
e) Message Flood Prevention: Previously, one could easily flood an
HTML client by sending data to it. If it could not work off the
incoming stream one would freeze the HTML client. Now, we wait for an
idle signal of the client prior to sending new data to it. Paired
with the message grouping and property cache mentioned above, we
are able to only send the newest data once the HTML client becomes
active again. I.e. we discard now-obsolete property updates etc.
Change-Id: I8f3ae16ed6c1f6a89b644acdce7efbf0f07fc786
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: I2e20aa13a598e65eafa9b9c145931a95e5f51a0e
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code is much simpler in my opinion and much faster and far more
stable. Especially the timer issues or multiple signal connects
are now properly resolved.
Also simplify the QML WebChannel API:
- Rename slot to sendRawMessage and signal to rawMessageReceived
- Add a QML helper that has a respond and sendMessage method that
transforms the input to the expected JSON format.
Change-Id: Ic3266329d1a2877bd46227e4ad70b88dc340d289
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
| |
Disable installation of examples
Change-Id: I85092b0a22da871fdf02f197d0b85e7dc33243bc
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
| |
This shows an issue with consecutive signal connections due to some error
in the socket communication. WebSockets should resolve this.
Change-Id: I091d70e5e7498abdcc449eeca8dfe171d1ce0287
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: I52a3fc53ba0c76489ffdc0634cfaff5b1c1e02a4
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
| |
When multiple signals or properties exist we must not fall into
the usual javascript closure trap - we used to only use the very
last signal/property of every object...
Change-Id: Ief24630cc4b4ce3935207a170711f66c3ef5d805
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
We register objects once after the webchannel has initialized.
The web view URL on the other hand gets changed via property
binding after the web channel's base url is set/modified.
This hopefully fixes a race condition between the client-side HTML
logic and the registering of objects on the host-side QML app.
Change-Id: Ie83f7a415d9005e805a544f25287e51e75fb4dec
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: Ic6c12fb6a51497129556b156483df59f8003c7a7
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
| |
Also move most of its implementation to C++ to reduce the context
switching.
Change-Id: I12d0284aa57d318eafe94d34e732796e522bcfd8
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: I6d3bdd438c02ed70281a299ae781fea49a0e4b9c
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It might becme a very common use case of the QWebChannel QML plugin.
Thus it should be as simple as possible for third party consumers to
setup a QWebChannel for QObject publishing.
The new API basically moves the QtMetaObjectPublisher along with
the JavaScript marshalling to the qwebchannl/src folder.
The updated qtobject example shows how this new API can be used.
Furthermore note how it is now trivially possible to register
multiple objects, which was not easily possible before.
Some notes on the applied refactoring:
- qobject.js contains the JavaScript QObject binding and was
refactored to support multiple objects.
- the MetaObjectPublisher contains a new handleRequest function
which handles the QML-side of the QObject binding. This is
implemented in QML, while the other book keeping and esp. the
classInfoForObject is still handled in C++ via the
QtMetaObjectPublisher class (which is registered as
MetaObjectPublisherPrivate and used by MetaObjectPublisher)
Change-Id: Id45121bb654447e095bf8a8062d0c8edf9dcb018
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: Ifc6d4cbb647edacfebae83fa84be8f6021483fe7
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
| |
It now sends the initial request again.
Change-Id: If99b2011e52f625276e4d85079b194bd10aa6461
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: I759262c77c5f659e8c2d390c9fc154fac5da221d
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
| |
Mostly done by using QML (i.e. QtQuick2) instead of QtDeclarative.
Change-Id: I4d4f3d8c30bc10683fd7ad8c12e6198b0d848876
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
| |
Change-Id: Idedb73408b2ee4fb8653ba5b74bf30aa503df779
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|