Monday, December 22, 2014

Meteor and Qt: match made in heaven

Meteor, say hello to cross-platform native app-development. Qt, say hello to a modern, reactive web back-end.

TL;DR You can write a native Qt / QML app and have Meteor as the back-end for real-time data distribution and remote procedures.


I've been looking at recent developments and since Meteor had it's 1.0 release recently, decided to take it for a spin... with Qt.

For those that have been living under a rock, Meteor is a node.js based web framework that can be used to create modern, responsive web apps. It does have Cordova/Phonegap support, so you can package your website as an app and deploy to Android or iOS, but obviously that leaves you short when it comes to truly native look and feel, performance, and full range of APIs.

Qt on the other hand is a native cross-platform application development platform and has an excellent track record when it comes to the sheer number of supported native platforms. It does have some server/cloud oriented functionality and services (see engin.io and https://qtcloudservices.com/ in general), but it's hard to beat the popularity and ecosystem (and therefore development speed) happening around Meteor.

Can we make this a match? Meteor for web and server-side, and Qt/QML for making snappy native applications that go beyond calling RESTful APIs and polling on one side, and packaging node.js and phonegap API/performance limitations on the other?

The answer is luckily yes - what makes Meteor so uniquely well positioned for this is it's Data Distribution Protocol, or DDP for short. It's a websocket-based channel where Meteor sends JSON messages to the clients. There is nothing special about this, so we can have a Qt client (turns out there is already a healthy list of DDP clients/libs, but none C++ or Qt-oriented).

Enter Qondrite, a lightweight QML wrapper for Asteroid, a Javascript client for Meteor. With Qondrite, you can use Meteor as the source of your models (yes, everything shown goes through models, not hardcoded lists and data). To check the feasibility, I took the Todo example from Meteor (meteor create --example todos) and used Qondrite to interface to the meteor application. As usual, the source of this demo is available on github.

The end result?




As promised, an integrated Meteor-Qt stack, with a whole lot of opportunity to take the idea even furher. For example, there is no reason why we couldn't send QML instead of Meteor's Blaze HTML templates, making fully dynamic UIs for native applications - how awesome would that be?

This makes Meteor super-well suited for multiplayer games, chat applications and any type of app that benefit from a scalable, client-agnostic back-end, and low-latency, high-performance on the client side.

Feel free to discuss at Hacker news or on meteor-talk !

1 comment:

  1. szia! using javascript server-side and c++ client side... times are changing :-) kudos for the library and post!
    I'll definitely follow your progress as we are eagerly looking into both frameworks.

    ReplyDelete