Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement XMPP to send push notifications

I would like to use XMPP so that my application will send out updates to an android phone (1.5 and higher). I pretty much want to use XMPP to send push notifications to the phone.

How would i go about achieving this. At the moment my web application is running on apache tomact with a number of servlets so the android phone can access information, but I'm finding it difficult understanding how I could implement XMPP so that I can push information from the server to the client (android phone).

I have tested the below tutorial Example of XMPP with Google ID login

It uses Google ID logins. But i need to use my webapplication to do what google implements. Any ideas?

like image 311
molleman Avatar asked Jul 08 '11 16:07

molleman


People also ask

What is 2fa push notifications?

Push Notification Authentication enables user authentication by sending a push notification directly to a secure application on the user's device, alerting them that an authentication attempt is taking place. Users can view authentication details and approve or deny access, typically via a simple press of a button.

Does XMPP support security?

XMPP has had its security vetted by the experts at the IETF, and so has native support for pluggable authentication (via SASL) and leading-edge security (via TLS).

What is push OTP?

Push authentication is one of the most secure and easy to use forms of user authentication. When a company issues an authentication challenge, the user only has to tap allow or deny when they receive the push notification on their phone—much easier than typing in a one-time password (OTP).


2 Answers

That would depend on the nature of your push (is it a point to point or pub sub). In either case, you will need an XMPP server that your clients and application are connected to. This will be the means for your application to send notifications to the clients.

Not sure what you mean by "I need to use my webapplication to what google implements". Your webapplication would be a client to the xmpp server, just like your phones. You cannot use xmpp to simply talk to your webapplication, unless it happens to be a bosh enabled xmpp server itself, which I would guess is not likely.

You can use Smack for your client communications, and any one of the many available servers.

If the communication is directed at specific clients, then creating a chat between the application and client is probably the simplest means. If it is more of a broadcast, then you could use either MUC (multi user chat) or pubsub.

like image 163
Robin Avatar answered Sep 21 '22 23:09

Robin


Generally, you would implement this as a pub-sub feature. Pub-sub is basically the publish/ subscribe paradigm: you publish something and they receive it.

Assuming you have an XMPP server setup that supports the pub-sub protocol extension (like eJabber), in your app, you would login to that server and subscribe to a node (where your update notifications would be sent), and with your subscription you would have to add a handler to handle any notification on that node.

On the server side, when you have something that all of your clients need to know about, you would publish the update to the same node that the clients subscribe to.

For more info, see http://xmpp.org/extensions/xep-0060.html

like image 27
ChicoBird Avatar answered Sep 17 '22 23:09

ChicoBird