创建聊天功能?
我需要在我的应用程序中包含聊天功能。人们登录聊天并创建他们的用户并与其他用户聊天。然而,它需要像 Facebook 聊天或 pingchat 一样,您可以在其中添加您想与之交谈的朋友。
谁能给我指点我需要做什么?我听说过 xmpp 服务器,但不确定这是否适合我的应用程序。任何帮助将不胜感激
谢谢
I need to include chat, in my application. People sign in the chat and create their user and chat to other users. However it needs to be like facebook chat or pingchat where you add friends you want to talk to.
Can anyone give me pointers to what i need to do? I've heard about xmpp servers but not sure if that is the right thing for my app. Any help would be much appreciated
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的应用程序是要创建新用户,并将其添加到聊天列表中,还是要在现有协议(如 IRC、XMPP 等)上使用现有用户(如 Gtalk、Y! Messenger 等)...?
如果您要实现您自己的聊天系统,您的用户将在您的网站上注册,那么您将执行以下操作:
它是如何运作的?
您保留一个聊天消息表。该表包括:
您所做的就是,当您启动从 Alice 到 Bob 的聊天会话时,您只需将它们输入到表中即可。接下来,通过调用 PHP 文件(例如 http://mychatserver .com/getChat.php)基于条件
SELECT CHAT_MESSAGE FROM CHAT_TABLE WHERE CHAT_FROM="ALICE" AND CHAT_TO="BOB";
。此消息显示在您的应用程序中。这个过程应该重复执行,间隔例如1秒。
我希望你有这个想法。
Is your app going to create new users, and add them in the chat list, or going to use existing users (like Gtalk, Y! Messenger etc) on existing protocols (like IRC, XMPP etc)...?
If you are going to implement your own chat system, where your users are registering in your website, then you are going to do these things:
How it works?
You keep a table of chat messages. The table include:
All what you do is, when you start a Chat session from Alice to Bob, you just enter them in the table. Next, you fetch the row from the Web Server to your App, by calling your PHP file (say, http://mychatserver.com/getChat.php) based on the condition
SELECT CHAT_MESSAGE FROM CHAT_TABLE WHERE CHAT_FROM="ALICE" AND CHAT_TO="BOB";
. This message is displayed in your App.This process should be performed repeatedly, with an interval of, say 1 sec.
I hope you got this idea.