Contain webhook in my client - java

I have a java client that reads and writes to a local postegresql database. The application receives SMS messages from Twilio through a webhook. Right now I use spark in the client and utilize ngrok to create a URL of localhost that twilio can use as the webhook. How can I scale this to production? I would like to keep the webhook as part of the client, so I can receive messages in real time instead of periodically requesting the messages from a web server.
Is this possible?

Related

Is storing ARNs the correct way to register and send to AWS SNS?

I'm trying to implement push notifications via AWS SNS using FCM/APNS. I've successfully done it manually via the SNS console and now I'm trying to implement the whole process via Java.
The tutorials are short-stopped at demoing the manual method and the AWS SDKs are not that explicit. The things I want to implement via SDK are
Create Platform Application ARNs (FCM/APN)
Create Endpoint ARN (Device Token)
Send Message to Endpoint ARN
Now each step is dependent on the previous step ARN, is it correct that the way to get these ARNs is storing and retrieving them on our database?
For example, to register an Endpoint ARN, I get Platform Application ARN from the DB (with the user's device token), register it on SNS and then save the endpoint ARN response to the DB?
Now if I want to send a message to that user then I just get his endpoint ARN from the DB and publish a message?
If you know of any guide that is useful for using SNS in code, either JS or Java you can put it in as an answer as well.
The recommendation is indeed that you store the ARN in your database for retrieval when you want to send a notification to that user. Most applications have an internal mapping, e.g. from user ID -> device ARN that SNS does not know about. This makes it difficult to target specific users unless you have this stored somewhere.
There is pseudo code available here which goes over best practices for creating and managing platform application endpoints. Keep in mind that this would all be running on your server.

Sending a large string to multiple users

My problem is how can I program an android app that sends a large string of alphanumeric characters to multiple android users.
QR code is limited and can't use special characters and lowercase ones.
Is it possible to send the string to multiple android users with the same app?
Just like ShareIt.
Please provide a reference where I can study more.
I'm new to Android, zero knowledge
One solution approach could be using a server and push messaging service. It can work as follows:
When someone (sender) wants to send a message, A query will be sent to the server with the message data.
The server receives the message and saves in a database. Here, we will get a reference to the message in database.
The server then sends the message to all receivers via push messaging service.
Caveat: The push messaging services have limits on how much data can be sent at a time. This can be overcome by sending the receivers only a reference to the message. In this case -
The receiver will query the server with the reference of message.
The server will response to the query with the message data.
All of this can be set up using Google's firebase platform. In that - firebase database will provide database, firebase cloud functions will handle the request, response logic and also send messages via the firebase cloud messaging

Rabbitmq , send message to appropriate consumer

I have three applications,
java rest api
android application
rabbitmq service
When android application is turn on it listens some queue then application can make http request and java rest api service put some message to this queue.
The question is, how to send message from rest api service to only one user, because all users are listening the same queue?

How to setup a FirebaseCloudMessaging server?

I did the android client side for FCM, I tested it using FCM console.
Now I need to setup a server which gets the registrationId from client using Http link and also sends push notifications. This is the first time I am setting up a server.

Use XMPP to implement a push notification infrastructure

I am currently working on a project which requires a server to request data from the devices which are currently connected to the server. Meaning, first the server finds out which devices are connected to the server and then sends an application specific message to the client device which should wake certain functionality present on the client.
I was looking into XMPP service which looked promising since it works as a PUSH notification. The in XMPP can be used to check if the device is currently connected and has subscribed to the server. Since every android user has a gmail account, I was thinking of using the gmail xmpp service to connect /subscribe to the server. Then send specific message to the client, i.e x...#gmail.com.
However if a message is sent this way the client app gets the message as well as the native gtalk client. So how do I go about intercepting this so that it doesn't show up on the gtalk client but my app still gets it ?
Use the full JID when sending the message. The send to multiple clients should only occur when the bare JID is used.
Full JID -> xyz#gmail.com/device
Bare JID -> xyz#gmail.com

Categories