[Development] QtWebChannel scope

Milian Wolff mail at milianw.de
Fri Jul 4 20:26:57 CEST 2014

On Friday 04 July 2014 12:41:46 Lutz Schönemann wrote:
> Hi Milian,
> when using the qwebchannel.js file to implement a client one can set a
> URL so that the QWebChannel object opens a websocket connection to that
> URL or just set an already connected socket right?
> But I'm thinking about setting a socket object that already has a send
> function, that will break my socket object (if I'm not doing some extra
> work) because QWebChannel sets the send property w/o checking if it
> already exists. I think there should be done some extra checks to make
> sure that the object you set the send function on is that WebView
> communication thing.

Hey Lutz,

refactoring the client-side code to be more similar to the server-side code 
(with plubbable transport objects) is something I would like to see as well. 
This will be required for proper QtWebKit/QtWebEngine integration anyways, and 
thus something I'll try to do next week, I hope. Help on that front would be 
welcome of course.

I guess all we need is a simple "abstraction" layer of a WebSocket, which can 
then be implemented in terms of a custom IPC mechanism, be it QtWebKit, 
QtWebEngine or anything else you already have at hand.


> On 07/04/2014 11:36 AM, Milian Wolff wrote:
> > On Friday 04 July 2014 11:11:13 Bernd Lamecker wrote:
> >> Hi,
> >> 
> >> do you plan to use QtWebChannel only "locally" or will it be possible to
> >> use the javascript part to connect a pure QML client to an QObject
> >> backend or maybe even use the javascript to connect a NodeJS server to a
> >> QObject?> 
> > Hey,
> > 
> > the plan for 5.4 is to ensure it works well with WebView (and hopefully
> > WebEngine as well) - so locally. But thanks to WebSockets, you can talk to
> > arbitrary remote clients as long as they support WebSockets. NodeJS should
> > thus be pretty trivial, I simply never tried it out so far but I don't see
> > any problem with that.
> > 
> > Regarding QML client and QObject backend, that should work the same way. I
> > just refactored the code yesterday and ported the unit tests such that
> > they
> > run the qwebchannel.js code inside V4. So you can setup a JS web channel
> > in
> > QML just fine and get objects somehow, e.g. again via websockets. What's
> > missing here is an implementation or auto-wrapper of QQmlWebSocket for
> > QWebChannelAbstractTransport. That's trivial to do though.
> > 
> > Bye
Milian Wolff
mail at milianw.de

More information about the Development mailing list