App Engine chat application - java

I am writing a chat application on app engine using xmpp. My idea is to allow users to chat to one another. I can get messages to send to a google talk account, by taking the logged in user and removing the #gmail.com part of the address and replacing it with #appid.appspotchat.com )so for example if the logged in user is bob#gmail.com, the jid used to send from will be bob#appid.appspotchat.com). You can then send messages to an google talk account, e.g. jeff#gmail.com.
My problem is in receiving the messages back again. The developer pages show how the app itself can receive messages to the appid#appspot.com jid, but how do you get it to receive messages to the appid.appspot.com jid, and then present these messages tp the logged in user? The overall idea is when a user logs in, I will retrieve thri contact list, get the presence of their contacts (replacing gmail.com with appid.appspotchat.com) then present the available contacts to the user.
If this is not possible, is there a way to let the logged in user chat to other users in a different way? Ive briefly looked at the channel api but i don't think this is suitable?

You could use the Channel API to send a message down to a client when your server gets a message intended for that user. There's no facility to direct a XMPP message directly to a user on your own page; the XMPP API is used to send messages to users signed in to XMPP clients (such as Gmail, Pidgin, etc).

You can't use anything#your_app_id.appspot.com. Instead you must use anything#your_app_id.appspotchat.com as described in XMPP Addresses.

Related

Send Notification to other users and other users have the option to accept or reject it

I am building an Android app and i am using Firebase as the database to store users and more. My requirement is that i need users to click on a button and send notifications to other users(typically they will be 2-3 users). When other users receive the notification they should have the option to "accept" it or "reject" the request. If they click to accept it the sender of the notification should get notified (just a notification) as well as the admin users.
I have found online several options on how to send notifications with FCM or using a third party server but the tricky part that i haven't found is how will they accept or reject a notification? Has anyone done something similar or can someone direct me to a solution that would satisfy this requirement(accept and reject a notification)?

Send/Receive Email from within Web Application?

I have an Order Management (Web) Application (in Java/Java EE).
The application users want to Send Receive email communication to Customers who placed the Order, from within the Web-Application. The Email Trail must be associated with the Order.
The use-case is:
User opens the Order Detail Page. Order info. is displayed.
On that page - Clicks on Email Icon, and it will show up all Email Communication (sent/received) for that Order till date.
For that Order - You can see new incoming mails, reply to mails or send out new mails to the Customer - all related to that Order.
Questions:
Sending out emails is easy, but how to receive emails within the app?
What is the email account here - A common Email Account called orders#myorg.com (and based on subject line/some-header emails are filtered etc.) or is it orderid#myorg.com (in which case new email acct creation is reqd per order) or ?
We already have Microsoft Exchange Server via which company email travels. Could we leverage that in someway or do we need to setup a new Mail Server?
Any ideas are welcome.
If you're willing to take on the dependency, Spring Integration can comfortably read email from a designated server on a polling (POP3, IMAP) or event-driven basis (IMAP-IDLE). [1 & 3]
[2] You can use a dedicate mail account and filter the mail sent to downstream channels based on the subject (or other field) of the incoming mail. The following snippet from the Spring site illustrates this:
<int-mail:imap-idle-channel-adapter id="customAdapter"
store-uri="imaps://some_google_address:${password}#imap.gmail.com/INBOX"
channel="receiveChannel"
should-mark-messages-as-read="true"
java-mail-properties="javaMailProperties"
mail-filter-expression="subject matches '(?i).*Spring Integration.*'"/>
Where mail-filter-expression filters the email that will be flushed down receiveChannel. For all interested parties (channels), you'll have one <int-mail:imap-idle-channel-adapter/> listening to your Exchange server.
While it's not cumbersome to use, I'd recommend you look at a short overview of EAI according to spring and of EAI in general
You need the following.
Java Mail API to programmatically send emails through some exchange server.
I would suggest to use a dedicated email server to receive application specific emails. You can do this by using James. You can send and receive emails through this software.
If you use your existing Microsoft Exchange Server, you can always use redirect to your application specific email server.
Receive emails
Here is example code to read an email Are there any good short code examples that simply read a new gmail message?
Email account here
For each user create an email account and have user's web app credentials used as credentials for email as well.
Use hashed order id as part of subject to relate each email chain to specific order.
Microsoft Exchange Server
Use either exJello is a JavaMail provider (http://www.exjello.org/)
OR Use JavaMail API with DavMail Gateway (http://davmail.sourceforge.net/)
From a user point of view I think keeping a specific subject is more difficult. I would suggest a sub domain like myapp.myorg.com or a new domain like myapp.com
Either ways have a catch all so that all mails go to a specific email like orders#myapp.myorg.com
Then your script can check the real TO. This might be more natural and 'cool' -> each order has its own mail id! On top of that use James or other mail software to get delivery to your code.

Send facebook messages using only server with no UI

I am looking to send a facebook message from my application server without
the need to prompt the user for input each time.
I have been looking over the facebook chat API but it only works with facebook UI
which means that the user must be prompted every time I want to use the chat.
Is there a workaround or am I missing something?
I am using JAVA on my server.

How to make reply of an email becomes a HttpRequestServlet to a web application?

I got a requirement which I don't know how to get started.
Requirement:
The application will send emails to clients (using org.springframework.mail.javamail.JavaMailSender) with same "from email address" as support#mydomain.com. Also the email content will have some hidden information such as client_id. If the client reply back to that email, I need to get that as an HttpServletRequest to a Servlet so that I can process it.
EDIT:
This web application does not have google app engine setup, but my requirement is matching similar to this link.
When someone replies to the mail you sent him that mail will go to the POP3 server configured for your domain. From this SMTP server you can read this mail using the Java Mail API. You can have a Spring timer task to keep polling this mailbox after every few seconds.
I would look at the below resources to see how to read mail from the POP3 server -
Using JavaMail API -
http://metoojava.wordpress.com/2010/03/21/java-code-to-receive-mail-using-javamailapi
Using Spring -
http://blog.solidcraft.eu/2011/04/read-emails-from-imap-with-spring.html
Better and popular solution is to have a link in your email and asking user to click it and asking specifically not to reply to this email (from address can be noreply#domain.com)
For getting a servlet call in an email reply, you need to use
http://javamail.kenai.com/nonav/javadocs/com/sun/mail/pop3/package-summary.html
Keep polling for new emails in your reply address(for eg support#domain.com) using POP, and when new email comes trigger a httprequest(HttpClient? ).
On a related note you can add user_id and similar stuff using a + in reply email address
For eg support#domain.com and support+uid_21_catid_32#domain.com will deliver to same address. Everything after + is ignored. But you will get this info in reply email event as to address and decide on who is the user.This could be a security concern for sure if not properly implemented.

capture outgoing packet sent by google chat in my application

I am familiar in using xmpp library,for android i'm using asmack library.In Google chat also asmack is used.i can write an application to send/receive messages using xmpp.But now i want to track google chat messages in my application.what ever the user do in google chat the same sholud be happening in my application.Suppose that user logged in google chat,in my appication also he is logged in.Sent messages /Incomming messages also should be in sync.i m able to do every thing except synchronizing outgoing sms.How to capture the packet when user is send a message from google chat into my application. ?
You should not be able to do that (unless rooted) as it would be security issue - anyone could sniff your any network activity that way. If your app sign in to the google talk server (as any other client) then you should receive copies of all the conversations, but that's it.

Categories

Resources