uniqush / uniqush-push

Uniqush is a free and open source software system which provides a unified push service for server side notification to apps on mobile devices.
http://uniqush.org
Apache License 2.0
1.53k stars 201 forks source link

For #177 : Support GCM&FCM "notification" payloads. #185

Closed TysonAndre closed 6 years ago

TysonAndre commented 6 years ago

To start with, do the simplest possible thing and allow users to provide these as a JSON blob over the REST API.

See the following links

"notification" payloads are rendered directly on the device by GCM, without needing the client apps to do anything (similar to APNS).

On a tangent, APNS now has silent notifications, and uniqush doesn't support those yet.

Example

Start a server

$ ./uniqush-push -config conf/uniqush-push.conf
[WebFrontend][Config] 2017/10/02 22:18:22 [Start] localhost:9898

Preview what Uniqush would send to FCM for the corresponding /push, within the field "payload" of the response (similar for GCM)

$ curl http://127.0.0.1:9898/previewpush \
    -d pushservicetype=fcm \
    -d 'uniqush.notification.fcm={"title":"my title","body":"notification body"}' \
    -d ttl=5
{"code":"UNIQUSH_SUCCESS","payload":{"notification":{"body":"notification body","title":"my title"},"registration_ids":["placeholderRegId"],"time_to_live":5}}

The push format is documented at the following links: