Our application is .net core api backend and reactjs frontend and hosted in Azure.
We have implemented firebase CM for both applications.
Client sends token to api to receive notification and api sends notifications.
Once we test local it works as expected but same code/application is not working at server.
I have logged the response and response status 200 and succeed 1 and got a message_id
We are stuck at the moment!
What is missing? Any idea?
Related
I have asp.net web application sending the web push notifications. Notifications should be received in my listener registered in service worker as self.addEventListener('push', function (event) {...}.
It works when I run the application at local host. But when I run application from the server (azure) at https domain I'm not getting any events in the listener. I can see in debugger the server sends the notification request and there is the same success response from fcm.googleapis.com like when I' running it from localhost, but notification never arrives to the browser. I have enabled notifications from my domain in the browser, I've tried desktop chrome, edge and also mobile chrome, nothing works. What can be wrong? What is the difference in notifications when application is running at localhost?
Notification was send from server, but breakpoint was not hit in browser's debugger in service worker's push handler and no notification was shown.
Update:
I've got notification on mobile phone my application was updated 1 or 2 days after my last touch to application. And next day I've started receiving notifications. But I'm still not getting them on desktop though.
I'm building a web app that has a service worker, which displays a notification when a message is sent. I've been using the Web Push API example (https://web-push-codelab.glitch.me/) as it's backend.
But I'm not clear on how notifications are sent to a service worker. Do I need to create a backend service that pushes out notifications, and as part of the registration of the service worker, I have to subscribe to an endpoint that the backend server provides.
Also do I need a 3rd party service that sends out the notification? That my backend service talks to?
I know how to setup a service worker, but not how to create the service that the Push Manager subscribes to.
In a webapp I am currently using an OpenID Connect token to authenticate users. I am now looking into using a Services Worker and Push API to do notifications. I understand that I need to register the service worker with the messaging provider (FCM) then send the client information to the app server so it can send messages through the provider. What I don't understand is how I prevent the client devices from receiving notifications if the user has logged out.
extra info:
The existing webapp uses IdentityServer 4 for the authorization server and oidc-client in the client.
I read that FCM has its own token you can delete to stop notifications but what if that code fails or the OpenID Connect token expires while the client isn't open (background notifications), what would preventing the server from sending notifications to the browser with stateless authentication.
TLDR
With to dis-joined systems: OpenID Connect that authenticates users, and FCM that authenticates devices. How do I make them work together?
I want to register my app for GCM services just after the user installs my app(i.e. before launch). Is this possible? Or else is there a hack available.
If you want follow the standard GCM client app registration process, your app has to launch in order register, because the app server and the client app must complete a client/server "handshake."
From the GCM documentation, it states that the client obtains a unique registration token and passes it to the app server, which stores the token and sends an acknowledgement back to the client app. The registration token exchanged in the handshake process is the same client app instance identifier used subsequently to send messages to the client.
so, if your app is not launched, you can not pass the registration token to the app server. For android, you need to use the Instance ID API to complete the process.
Sample code:
InstanceID instanceID = InstanceID.getInstance(this);
String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId),
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
(notice the R.string.gcm_defaultSenderID is a project number you acquire from the API console. )
There was a hack in this post, if you want to start a service after an app is installed. But it might not be a good practice for you to complete the registration process, because you hard code the Sender ID, Application ID and Sender Auth Token listed in this page.
I would like to know if there is an API which can receive push notifications for an email client.
Use Case: I would like the server to send my web service notifications on new email. I would not like to poll the server. I would like the server to send notification (PUSH) to the web application.
Also, what are the (if any) mail servers that support this kind of API?
Check out Cloudmailin which is a SAS that will do REST post back to your server