Is GAE Channel API only for creating chat rooms, or can it be used to implement 1-to-1 chat applications also?

StackOverflow https://stackoverflow.com/questions/23477745

Question

I am trying to build a simple GAE chat application in java, that would have users talk to each other in 1-to-1 conversations.

I thought about using the Channel API, but I just realized that a ChannelMessage can only be sent to users that are online at the same time. In other words, only the users that have channels created can receive the message, because the sendMessage method of a ChannelService object would need to have as the first argument, the clientId that the other user used to create his channel.

Am I understanding this correctly?

And if so, what else would you recommend, for implementing a simple chat app where users should be able to have a friends list from which they would select a friend to talk to? Is XMPP a valid option?

(My app should also need an "Add friend to your list" functionality, and some way of storing information (users and messages) in a database probably Datastore API, as it is the only one that offers a free quota with daily limits)

Please help. Thank you!

Was it helpful?

Solution

You can use the channel api + datastore. You need to keep track of users when they are connected and when they disconnect from the channel, see here. When they are disconnected, persist the message to the datastore, and show it to them when they are online.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top