PWA Part -1: Web Push Notification

Push Notification Intro And Prerequisites 

 Hello, Developers, this is my first Blog Hope this will help in an extent.

Nowadays there is a huge demand from the client to make there portal PWA enables, they should be get notified by browser notification, offline pages will display and function properly when browser offline and etc.... If you want to your users engaged then this is the best way even they are coming into your sites frequently.   

Below is the Prerequisites libraries to enable push notification in Liferay

  • webpush libs(
  • bouncy castle jar is required to authenticate.
  • A remote server(plain web server) or in the same server a servlet Application(You can try in same Liferay portlet also for it's doesn't work).

For browser push notification Liferay doesn't provide any by default solution I have tried a lot at least a month to achieve that from several ways Below is the Final solution.

There are few Steps to create browser push notification they are : 

Front End Tasks

1. Register a service worker which will get the user's browser information  and store into DB.

2.Get the subscription object and validate with authentication if needed(In chrome definitely).

3. fetch(send the URL to store for push notification) for sending and receiving the push notification.

4. Create manifest.json file in your portlet(which is used for Google Chrome).

Server Side Tasks

1.Store the DATA into DB(It's Your mechanism).

2. Create Subscription Object and payload(data to be displayed in push notification).

3.VAPIDS  public and private keys for authentication.

4. Send the push request to push notification servlet(My mechanism).

5. In PushNotification Servlet Send the notification from WEBPush-libs. 


Before that let's do some Check to work all the things fine without getting much error or avoiding the known errors. 

1.Enable the bouncy castle provider in your JDK

Steps to enable as follows

  1. Add the Bouncy Castle provider jar to the $JAVA_HOME/jre/lib/ext directory
  2. Create a Bouncy Castle provider entry in the $JAVA_HOME/jre/lib/security/ file

The entry java.securitywill look something like the following:


Replace with theN order of precedence you would like to give Bouncy Castle in comparison to the other providers in the file. Recommended would be the last entry in the list -- N being the highest number in the list. Warning that configuring Bouncy Castle as the first provider, security.provider.1may cause JVM errors.

2. make sure bouncy castle jar will present either in your JDK or in your application. (Recommended is your JDK).


So now we all set for coding part so let's do in the next part of this series.

Please post your Comment and review if I am mistaken somewhere  or having some wrong information(if you think).Please Let me know.

We will meet soon in next part with A lots of code.  

Meanwhile, if you want to verify the above information or want some more information about service worker the kindly have a look on blow links.

1. Bouncy Castle.)

2. Notification Intro).


4. usages)


Hello Sudhanshu i am working on PWA for my application, can you please share sample code for service worker registration if possible.