This command is only available in authenticated or selected state.¶
- Arguments (create/update):
-
subscription ID¶
-
push endpoint¶
-
ECDH public key¶
-
authentication secret¶
- Arguments (delete):
-
subscription ID¶
-
NIL¶
- Responses (inactive subscription):
-
- untagged response:
-
WEBPUSH¶
-
VAPID¶
- Responses (active subscription):
-
-
OPTIONAL untagged response:
-
WEBPUSH¶
-
VAPID¶
- Result:
-
- OK -
-
creation or deletion completed¶
-
- NO -
-
creation failure: can't create webpush subscription with these arguments¶
-
- BAD -
-
command unknown or arguments invalid¶
The WEBPUSH command creates, updates or delete a push subscription for the account. New subscriptions and updated subscriptions (with at least one different field) aren't active until the subscription is confirmed with the ACKWEBPUSH command.¶
The subscription ID is unique per account and identifies the push subscription. Sending a WEBPUSH command with an existing subscription ID updates the current subscription. Sending a WEBPUSH command with an existing subscription ID following by NIL deletes the subscription.¶
If the client tries to delete a subscription with an unknown subscription ID, the server returns a tagged OK response.¶
If the subscription is inactive or is deactivated by the command, the server MUST return a single untagged WEBPUSH response before the tagged OK response and MUST return a single untagged VAPID response before the tagged OK response. The VAPID response can be used by the client to check if the server has rotated its VAPID keys.¶
If the subscription is still active after the command, the server MAY return a single untagged WEBPUSH response and MAY return a single untagged VAPID response before the tagged OK response.¶
If the subscription was activated (i.e. created and then confirmed/acknowledged) with a VAPID key that is not the current VAPID key (due to a key rotation), then subscription MUST be deactivated by this command, and a confirm/acknowledgement is required to activate the subscription again.¶
If the updated or created subscription is inactive after the command (this is a new subscription, at least one field is different or the VAPID key has been rotated), the server MUST send an ACKWEBPUSH response with a push notification, encrypted with the new public key, to the new endpoint. The client will have to send a ACKWEBPUSH command to (re-)activate the subscription. The client knows if the subscription is deactivated thanks to the untagged WEBPUSH response.¶
The push endpoint MUST be the URI that the mail server sends push messages to. This is defined as the URI for push resource in [RFC8030]. This URI MUST use the "https" scheme.¶
The ECDH public key is the user agent public key on the P-256 curve. It MUST be encoded in the uncompressed form [SEC_1] (section 2.3.3, replicated from X9.62), and base64url encoded as described in [RFC7515]. This is used to encrypt push notifications following [RFC8291].¶
The authentication secret is 16 random bytes. It MUST be base64url encoded as described in [RFC7515]. This is used to encrypt push notifications following [RFC8291].¶
The client SHOULD reregister their push subscription from time to time, like every time the client starts, in order to restore subscriptions, in case the endpoint was removed. Subscription may be removed if the push server has been in an inconsistent state, or if the mail server has been restored from a backup.¶
The capabilities that were enabled using the ENABLE command at the time of the WEBPUSH command are associated with the subscription. When sending push messages, the untagged messages are formatted according to those capabilities. For example, enabling IMAP4rev2 or UTF8=ACCEPT cause mailboxes to be in UTF-8, and enabling CONDSTORE causes MODSEQ to be added to UIDFETCH responses.¶
Example:¶
C: a1 LWEBPUSH *
S: a1 OK LWEBPUSH completed
C: a2 WEBPUSH a8282bf9-6102-4e1b-bb61-d26d0e532e65 \
https://push.example.net/push/random1 \
BCVxsr7N_eNgVRqvHtD0zTZsEc6-VV-JvLexhqUzORcxaOzi6-AYWXvTBHm4bj\
yPjs7Vd8pZGH6SRpkNtoIAiw4 \
BTBZMqHH6r4Tts7J_aSIgg
S: * VAPID BOniQ9xHBPNY9gnQW4o-16vHqOb40pEIMifyUdFsxAgy\
zVkFMguxw0QrdbZcq8hRjN2zpeInRvKVPlkzABvuTnI
S: * WEBPUSH a8282bf9-6102-4e1b-bb61-d26d0e532e65 \
https://push.example.net/push/random1 NIL
S: a2 OK WEBPUSH completed
C: a3 WEBPUSH a8282bf9-6102-4e1b-bb61-d26d0e532e65 \
https://push.example.net/push/JzLQ3raZJfFBR0aqvOMsLrt54w4rJUsV \
BCVxsr7N_eNgVRqvHtD0zTZsEc6-VV-JvLexhqUzORcxaOzi6-AYWXvTBHm4bj\
yPjs7Vd8pZGH6SRpkNtoIAiw4 \
BTBZMqHH6r4Tts7J_aSIgg
S: * VAPID BOniQ9xHBPNY9gnQW4o-16vHqOb40pEIMifyUdFsxAgy\
zVkFMguxw0QrdbZcq8hRjN2zpeInRvKVPlkzABvuTnI
S: * WEBPUSH a8282bf9-6102-4e1b-bb61-d26d0e532e65 \
https://push.example.net/push/JzLQ3raZJfFBR0aqvOMsLrt54w4rJUsV NIL
S: a3 OK WEBPUSH completed
C: a4 LWEBPUSH *
S: * WEBPUSH a8282bf9-6102-4e1b-bb61-d26d0e532e65 \
https://push.example.net/push/JzLQ3raZJfFBR0aqvOMsLrt54w4rJUsV NIL
S: a4 OK LWEBPUSH completed
C: a5 WEBPUSH a8282bf9-6102-4e1b-bb61-d26d0e532e65 NIL
S: a5 OK WEBPUSH completed
C: a6 LWEBPUSH *
S: a6 OK LWEBPUSH completed
¶