icon option in payload is essentially a small image you can show next to the title and body text.
Large image with notification:
image option in payload can be used to display a larger image to the user. This is particularly useful to display a preview image to the user.
Since Chrome on desktop doesn’t fill the available space and has a ratio of 4:3, perhaps the best approach is to serve an image with this ratio and allow Android to crop the image. That being said, the
image option is still new and this behavior may change.
since Chrome 59 The image is not visible for Mac OS X users.
Sending multiple notifications:
It's not unreasonable for a site to send the user lots of important and relevant updates. However, if you don't build them correctly, they can become unmanageable for the user.
A simple technique is to group messages that are contextually relevant into one notification. For example, if you are building a social app, group notifications by sender and show one per person. If you have an auction site, group notifications by the item being bid on.
The notification payload includes a
tag attribute that is the grouping key. When sending a notification with a
tag and there is already a notification with the same
tag visible to the user, the system automatically replaces it without creating a new notification.
Not giving a second cue is intentional, to avoid annoying the user with continued beeps, whistles and vibrations. To override this and continue to notify the user, set the
renotify attribute to true in the notification options object:
Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default. On platforms that don't support a notification center (Windows, Linux & Mac), -2 and -1 result in an error as notifications with those priorities will not be shown at all. e.g.