linagora / tmail-backend

GNU Affero General Public License v3.0
41 stars 22 forks source link

[FireBase] Tunning for priorities #502

Closed chibenwa closed 1 year ago

chibenwa commented 2 years ago

If the StateChange contains EmailDelivery type => high priority

If the StateChange do not contain EmailDelivery => normal priority

CF WebPush

  private def urgency(stateChange: StateChange): PushUrgency =
    if (stateChange.changes
      .values
      .flatMap(_.changes.keys)
      .toList
      .contains(EmailDeliveryTypeName)) {
      High
    } else {
      Low
    }
quantranhong1999 commented 2 years ago

Some findings regarding this topic:

vttranlina commented 2 years ago

if the tunning is the firebase site, we just add webpush.headers.Urgency in the request to firebase the priority level will be stored in the database ( Firebase subscription storage) and the client can change it via jmap FirebaseSubscription/set

vttranlina commented 2 years ago

Should we do it on tmail site? eg: create two channels (high/normal), with each priority, the WebPushEvent will be sent to HighQueue or NormalQueue

quantranhong1999 commented 2 years ago

if the tunning is the firebase site, we just add webpush.headers.Urgency in the request to firebase

I think this webpush.headers.Urgency is only for firebase -> another web push gateway -> devices. We will directly use the flow: firebase -> devices (iOS/android).

quantranhong1999 commented 2 years ago

webpush.headers.Urgency is only for firebase -> another web push gateway -> devices.

Reread the material again, actually, FCM' web push directly pushes to web browsers. So yeah we can tuning this webpush.headers.Urgency for web devices also.

quantranhong1999 commented 2 years ago

https://github.com/linagora/tmail-backend/pull/521/commits/c4bf343b955d0d89ac52d98e41be811fabaeff24