-2

I want to implement fcm push notification like other websites facebook,amazon etc. for my web app built on spring and Jsp. I go through the all google docs but didn't find any. How other website ask user to send them notification and after allowing they start sending?

  • You need to use the W3C Push API as I have described in [this answer](https://stackoverflow.com/a/34920874/51387). – collimarco May 16 '18 at 13:04

1 Answers1

0

HTTP, which has a request-response model, is ill suited for the job. You asked how some applications do it, well the older ones create a HTTP channel which remains open for the application lifetime. The backend pushes new data to this channel as and when new events occur.

Any application that is reasonably modern uses websockets. See the WSS protocol. There are libraries built around this protocol to make it easier to consume, such as socket.io. You should read the MDN reference as well: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications

Timir
  • 1,395
  • 8
  • 16
  • I am asking about fcm notifications that is implemented in my android app, I want it to implement on my web app also. and you are saying me to read document of web sockets if user is on chrome on another site how it will send notification without fcm – Abhishek Tripathi May 16 '18 at 13:44