Skip to content

An implementation of Qt's WebChannel protocol in C++14

License

GPL-2.0, LGPL-3.0 licenses found

Licenses found

GPL-2.0
LICENSE.GPL2
LGPL-3.0
LICENSE.LGPL3
Notifications You must be signed in to change notification settings

MenloSystems/webchannelpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WebChannel++

What is WebChannel++?

WebChannel++ is an implementation of Qt's WebChannel protocol in C++14. WebChannel++ is header-only and depends only on standard library features and Niels Lohmann's excellent JSON Library for C++.

Usage

To use it, you will have to define your own Transport subclass to handle the network related tasks (sending and receiving messages). An examplary implementation based on the standalone asio library is included in asio_transport.h. This implementation communicates via TCP/IP and expectes messages to be newline-delimited.

Caveats

QObject marshalling

Due to some restrictions in nlohmann::json, plain pointers to objects can't be marshalled to or from json. To circumvent this, WebChannel++ defines the transparent pointer class QObject::Ptr. It acts and behaves just like a QObject* (and can implicitly be converted to and from QObject*), but is a separate type which can be marshalled to and from nlohmann::json.

In practice, you only have to care about this when you retrieve a property or a get the return value from a method:

// WebChannelPP::QObject *value = obj->property("value");  // WRONG!
WebChannelPP::QObject::Ptr value = obj->property("value");  // correct

About

An implementation of Qt's WebChannel protocol in C++14

Resources

License

GPL-2.0, LGPL-3.0 licenses found

Licenses found

GPL-2.0
LICENSE.GPL2
LGPL-3.0
LICENSE.LGPL3

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published