对于聊天应用程序,GCM 或套接字哪个更好?

Which is better GCM or Sockets for chat application?

我是 android 的新手,听说对于聊天应用程序,我们可以使用这两种方法中的任何一种,Socket 或 Gcm,但我不知道哪种方法对未来的前景更好。谁能把我从这个困惑中拉出来?

我不建议用GCM制作聊天应用,因为它会减慢聊天速度。您可以使用 Quickblox api 实现聊天。它是免费的,具有良好的功能,可靠且易于实施。这是聊天应用程序的示例 http://quickblox.com/developers/Android_XMPP_Chat_Sample

你也可以使用 ejabberd https://www.ejabberd.im/ on your server and Smack https://github.com/igniterealtime/Smack in your android client to connect with ejabberd server. If you are using ubuntu server then here is an excellent guide to install ejabberd https://www.digitalocean.com/community/tutorials/how-to-install-ejabberd-xmpp-server-on-ubuntu