Open Christilut opened 6 years ago
Push notifications are currently not supported.
Would it be possible to run the sync command inside a serviceworker and display a notification from there? That seems like the easiest option, if possible.
Sure is possible
Hmm I tried to get this working but BackgroundSync wouldn't update the matrix client. Creating a backend solution for push notifications now, and maybe abusing some Synapse endpoints to get the right information.
I have a standalone Matrix Synapse deployment and a custom Push Gateway (my own service) how do I tell Synapse to use my gateway?
I thought it was done via this SDK.
the SDK is meant to have a constant connection to your server via a /sync
poll loop.
So notifications would be calculated that way.
As you have a constant connection, you have no need for a dedicated push gateway. And therefore you cannot configure that
Found it: http://matrix-org.github.io/matrix-js-sdk/0.11.0/module-client-MatrixClient.html
There's a setPusher method, which is very poorly documented. The parameters it takes are described in the protocol spec here: https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0- pushers-set
One of the args is the gateway URL. So obviously @krombel obviously talking nonsense.
When I run this in cordova the user can kill my app any time. Same thing in the browser I want to notify users via webpush or APNS or GCM.
All of this are legitimate use-cases.
Ohh. Sorry...
You are right there is setPusher(pusher, callback)
which accepts a pusher
object as defined here.
I was referring to Riot which does not implement some push API but uses an ever running /sync
loop.
And because it is not used there I somehow thought it is not part of the underlying js-sdk...
Thanks for proving me false @oliverjanik. I have simply not thought of that possibility...
I'm trying to figure out how to get push notifications working. It is my understanding so far that the client decides which Sygnal server to use, but I can find no reference to anything related to Sygnal or push notifications in the SDK.
Does the JS SDK support this? What is the suggested way to get push notifications working, if possible at all?