New client languages for Qt WebChannel

At the company I’m working at, we’re employing Qt WebChannel for remote access to some of our software. Qt WebChannel was originally designed for interfacing with JavaScript clients, but it’s actually very well suited to interface with any kind of dynamic language.

We’ve created client libraries for a few important languages with as few dependencies as possible: pywebchannel (Python, no dependencies), webchannel.net (.NET/C#, depends on JSON.NET) and webchannel++ (header-only C++14, depends on Niels Lohmann’s JSON library).

Python and .NET are a pretty good match: Their dynamic language features make it possible to use remote methods and properties like they were native. Due to being completely statically typed, C++ makes the interface a little more clunky, although variadic templates help a lot to make it easier to use.

As with the original Qt WebChannel C++ classes, transports are completely user defined. When sensible, a default implementation of a transport is provided.

Long story short, here’s an example of how to use the Python client. It’s designed to talk with the chatserver example of the Qt WebChannel module over a WebSocket. It even supports the asyncio features of Python 3! Relevant excerpt without some of the boilerplate:

pywebchannel can also be used without the async/await syntax and should also be compatible with Python 2.

I would also really like to push the code upstream, but I don’t know when I’ll have the time to spare. Then there’s also the question of how to build and deploy the libraries. Would the qtwebchannel module install to $PYTHONPREFIX? Would it depend on a C# compiler (for which support would have to be added to qmake)?

In any case, I think the client libraries can come in handy and expand the spectrum of application of Qt WebChannel.

6 thoughts on “New client languages for Qt WebChannel

  1. Pingback: Links 16/7/2018: Linux 4.18 RC5, Latte Dock v0.8, Windows Back Doors Resurface | Techrights

  2. Jewell Sherron

    Today, I went to the beachfront with my children. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone!

  3. Mable Kise

    I was just looking for this info for some time. After 6 hours of continuous Googleing, finally I got it in your site. I wonder what’s the lack of Google strategy that do not rank this type of informative websites in top of the list. Usually the top websites are full of garbage.

  4. Josie Figone

    Thanks for your article. I would love to say a health insurance dealer also works for the benefit of the particular coordinators of the group insurance cover. The health insurance agent is given a list of benefits wanted by someone or a group coordinator. Exactly what a broker will is hunt for individuals and also coordinators which best match up those demands. Then he reveals his ideas and if both parties agree, the actual broker formulates a contract between the 2 parties.

  5. JamesAtons

    Hello.

    Downloads music club Dj’s, mp3 private server.
    http://0daymusic.org/

    Private FTP Music/Albums/mp3 1990-2018:
    Plan A: 20 EUR – 200GB – 30 Days
    Plan B: 45 EUR – 600GB – 90 Days
    Plan C: 80 EUR – 1500GB – 180 Days

    Best Regards,
    Robert

  6. Maisha Ghane

    Howdy! I just wish to give an enormous thumbs up for the nice info you’ve got here on this post. I can be coming back to your weblog for more soon.

Comments are closed.