QJsonChannel is a Qt implementation of the JSON-RPC protocol, which mimics to the functionality provided by QtWebChannel. Like QtWebChannel, QJsonChannel is leveraging Qt's meta-object system for method invocation. But unlike QtWebChannel is utilizing the idea of uni-directional communication. The project was started as a try to build an analog of QtWebChannel more suitable for stateless services.
QtWebChannel | QJsonChannel | |
---|---|---|
RPC protocol | Internal JSON-based | JSON-RPC 2.0 |
Communication protocol | bi-directional | uni-directional |
Stateless communication | - | + |
Server->Client call | + | - |
WebSocket support | + | + |
HTTP support | - | + |
Services list | Internal representation | JSON Schema Service Descriptor |
- QJsonChannelCore - RPC layer based on top of Qt meta objects invocation
- qjsonchannel.js - JavaScript layer over simple-jsonrpc-js which uses the JSON Schema Service Descriptor for building JS stubs on client side.
- QJsonChannelEmbed - the library utilizes QtWebChannel internal transport for passing messages to QJsonChannel RPC layer
- QJsonChannelBeast - the library utilizes Boost.Beast library for WebSocket and HTTP transport over QJsonChannel RPC layer
- QJsonChannelTufao - the library utilizes Tufao library for WebSocket and HTTP transport over QJsonChannel RPC layer
- set BOOST_ROOT environment variable
- cd QJsonChannel
- mkdir build && cd mkdir
- cmake -DCMAKE_INSTALL_PREFIX:PATH=../install -G "Visual Studio 15 2017 Win64" ..
- cmake --build . --target install
- cd QJsonChannel
- mkdir build && cd mkdir
- cmake -G "Visual Studio 15 2017 Win64" ..
- cmake --build .
- (for installation) cmake --build . --target install
- (for VS debugging) devenv Project.sln
- Tufao QJsonChannel Server illustrates the building of JSON-RPC services using QJsonChannel and HTTP/WebSocket Tufao server. The QJsonChannel server supports JSON-RPC calls and provides service descriptions by JSON Schema Service Descriptor.
- Boost.Beast QJsonChannel Server illustrates the building of JSON-RPC services using QJsonChannel and HTTP/WebSocket Boost.Beast server. The QJsonChannel server supports JSON-RPC calls and provides service descriptions by JSON Schema Service Descriptor.
- HTTP JSON-RPC Client shows access to JSON-RPC server using HTTP transport
- WebSocket JSON-RPC Client shows access to JSON-RPC server using WebSocket transport.
- WebSocket QJsonChannel Client shows access to QJsonChannel server using WebSocket transport and client-side stubs.
- HTTP QJsonChannel Client shows access to JSON-RPC server using HTTP transport and client side stubs
- Automatic UI Generation using React and QJsonChannel shows how to generate UI forms for RPC functions exposed by the QJsonChannel server.
- HTTP JSON-RPC Client shows access to JSON-RPC server using HTTP transport and client-side stubs using jsonrpc-requests Python libary
All of these tests can work with with Tufao QJsonChannel Server or Boost.Beast QJsonChannel Server.
- QtWebChannel Hybrid Application illustrates a hybrid approach of application building. The example includes the logic of both frontend and backend and uses QtWebChannel for the communication between JavaScript and C++.
- QJsonChannel Hybrid Application illustrates the same idea as QtWebChannel Hybrid Application but uses QJsonChannel "instead of" QtWebChannel. Actually I have difficulties with the internal web channel transport access. So, currently I'm using the QtWebChannel for message passing, but the service invocation is done using QJsonChannel.
- For any QtWebChannel example may require Deploying Qt WebEngine Applications.
- Use Google Chrome http://localhost:9090 for debugging
- Qt 5.5 or greater
- boost 1.67 or greater
- QtWebChannel enables peer-to-peer communication between a server (QML/C++ application) and a client (HTML/JavaScript or QML application)
- QJsonRpc is a Qt implementation of the JSON-RPC protocol.
- Boost.Beast HTTP and WebSocket built on Boost.Asio in C++11
- TUFÃO is an asynchronous web framework for C++ built on top of Qt
- simple-jsonrpc-js - Simple JSON-RPC javascript library. Generate and parse json rpc messages
- jsonrpc-requests - compact and simple JSON-RPC client implementation
- JSON is a lightweight data interchange format.
- JSON-RPC is lightweight remote procedure call protocol similar to XML-RPC.
- React JSon Schema Form A React component for building Web forms from JSON Schema.
- JSON Schema Service Descriptor is simply a JSON Schema with the additional definition for methods.