[Interest] Qt App & Web Push Notifications

Konstantin Tokarev annulen at yandex.ru
Sat May 6 14:47:47 CEST 2017



06.05.2017, 15:33, "Nuno Santos" <nunosantos at imaginando.pt>:
> Hey,
>
> Thanks for your reply. I think you are having a wrong interpretation of the REST API capabilities.
>
> OneSignal's server API can be used to:
>
> - Programmatically deliver notifications from your server or device to another device.
> - Add, update, and fetch data for your users without using our mobile or web SDKs.
> - Export User or Notification data from OneSignal.
>
> What I want to do is to register Qt App as a device, in this case, a web client, to receive a push on it.

I suppose there should be some request that allows you to receive notifications, using one of well known ways: 1) "long polling"; 2) infinite chunked-encoded reply (aka "http streaming", "forever iframe"); 3) server-sent events which is basically (2) with metadata; or 4) websockets.

E.g. this Nginx module allows you to set up any of these methods easily:

https://github.com/wandenberg/nginx-push-stream-module

>
> I’m not very familiar with QWebEngine or similar classes usage. That’s why I was asking.
>
> For instance, I don’t know how to make a QWebEngine load external javascript like the one needed in this config steps:
>
> https://documentation.onesignal.com/v3.0/docs/web-push-sdk-setup-http
>
> Also, it seems that the java script lib from OneSignal takes care of the communication with the browser, so I don’t know how to pick the push notification that arrive to the client.
>
> What do you think?

I don't think you can intercept notification requests in QtWebEngine, but you can do this with QtWebKit.

As for JS SDK set up, it's rather simple: you need to create page that uses SDK, and load it into web view, scripts and other resources can be loaded via qrc:// or web URLs

>
> Regards,
>
> Nuno
>
>> On 6 May 2017, at 12:15, Konstantin Tokarev <annulen at yandex.ru> wrote:
>>
>> 06.05.2017, 13:59, "Nuno Santos" <nunosantos at imaginando.pt>:
>>> Hi,
>>>
>>> I’m trying to find a way of having push notifications on a qt based desktop app taking advantage of web push technology.
>>>
>>> For instance, OneSignal provides a push notification that works for iOS, Android and desktop (safari, chrome, firefox).
>>
>> If you want to use OneSignal in your Qt application, they seem to provide REST API that should work with any HTTP client, including QNetworkAccessManager.
>>
>> https://documentation.onesignal.com/v3.0/docs/onesignal-api
>>
>>> I was wondering if I could have something like a web view or web engine running on the qt app, that could serve has the target browser for the notification.
>>
>> Why not?
>>
>>> Do you think this approach is possible?
>>>
>>> If this is not possible. How could I have such a system without having to build one from scratch?
>>>
>>> Thanks in advance,
>>>
>>> Regards,
>>>
>>> Nuno
>>>
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>> --
>> Regards,
>> Konstantin


-- 
Regards,
Konstantin



More information about the Interest mailing list