| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 will allow us to create a stand-alone WebChannel C++ library,
without any QML dependencies, that can be used to publisher QObjects
to remote clients running in any browser engine supporting WebSockets.
The patch is large, as working with introspection through the
QMetaObject from C++ is more complicated compared to QML.
On the other hand, the move to C++ allows a much more performant
implementation of quite some parts of the publisher. One thing is
that signal and method invocations can be handled via numeric indices,
where before we needed to transmit the string identifier of the
signal or method.
Eventually this can now also be applied to properties, further
decreasing the size of messages between server and clients.
Note that this patch contains quite some TODOs and rough edges,
such as the invokable bench_* helper functions in the public API
of the MetaObjectPublisher. These are to be seen as temporary, and
will be cleaned up in followup commits later. This is done to prevent
a further blow-up of this already big patch.
Change-Id: I57e788d8a19edd410651611382d912f9ad6660c9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
By handling more logic on the C++ side, such as serializing the JSON
data to QByteArray, we can save up to 6% in the propertyUpdates
benchmark.
Furthermore, this allows for some more code cleanup and obsoletes the
WebChannel.qml file.
Also, it is a first step towards removing the QML dependency and
making it optional alltogether.
Change-Id: Id610b5f2652da4a7ad867aef576fabcc40d3d92c
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tests the functionality of publishing a plain QtObject from
QML to the HTML client.
It tests property binding, i.e. reading and writing of an objects
property on the client side, as well as change notification tracking.
Furthermore a server-side method is invoked from the client and
signal submission from the server to the client is tested.
Change-Id: I62e544cddf4483b57535a9bc1e05a36105ec6622
Reviewed-by: Zeno Albisser <zeno.albisser@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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This uncovered a bug in webchannel.js, which stringified strings leading
to duplicated quoting. This is also fixed now.
Furthermore, some QMake changes are required to make it possible to run
the tests without first installing QWebChannel.
Change-Id: If7e8f73a748f86f2d5c7d39000e90612367038af
Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Mostly done by using QML (i.e. QtQuick2) instead of QtDeclarative.
Change-Id: I4d4f3d8c30bc10683fd7ad8c12e6198b0d848876
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
|
| |
|
| |
|
| |
|
|
|