Add support for webpush pusher as defined in MSC4174#1201
Add support for webpush pusher as defined in MSC4174#1201MatMaul wants to merge 2 commits intoelement-hq:masterfrom
webpush pusher as defined in MSC4174#1201Conversation
anoadragon453
left a comment
There was a problem hiding this comment.
Needs a few updates with respect to the latest draft of MSC4174 (f59cb97551216812d1ca492fafba05d057cc1298)
| const subscriptionData = subscription.toJSON(); | ||
| const pushkey = subscriptionData.keys.p256dh; | ||
| const data = { | ||
| endpoint: subscriptionData.endpoint, |
There was a problem hiding this comment.
This has been replaced with a url field in the latest version of the MSC.
There was a problem hiding this comment.
The new endpoint has to go there: https://github.com/element-hq/hydrogen-web/pull/1201/changes#r2923213109
This endpoint field is used for the current http pusher. That's OK to keep it with the new pusher, it will simply be ignored. To make things a little more evident, we can do supportDirectWebPush ? null : subscriptionData.endpoint
| } | ||
|
|
||
| async enablePush(pusherFactory, defaultPayload) { | ||
| async enablePush(pusherFactory, defaultPayload, hsApi) { |
There was a problem hiding this comment.
Does this code handle the 201 response code that the MSC asks for?
If the request creates a new pusher or modifies values under
pushkey,PusherData.url, orPusherData.auth, then the server MUST respond with 201, ...
as well as handling the subsequent validation push containing app_id and ack_token?
There was a problem hiding this comment.
We seem to also be missing the bit where the client calls POST /_matrix/client/v3/pushers/ack after receiving the validation push.
The client needs to handle the new M_EXPIRED_ACTIVATION_TOKEN and M_UNKNOWN_ACTIVATION_TOKEN error types.
| ); | ||
| if (supportDirectWebPush) { | ||
| return pusherFactory.webpushPusher( | ||
| this._pushConfig.appId, |
There was a problem hiding this comment.
| this._pushConfig.appId, | |
| subscriptionData.endpoint, | |
| this._pushConfig.appId, |
matrix-org/matrix-spec-proposals#4174