创建聊天功能?

发布于 2024-11-26 23:21:15 字数 171 浏览 3 评论 0原文

我需要在我的应用程序中包含聊天功能。人们登录聊天并创建他们的用户并与其他用户聊天。然而,它需要像 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三生池水覆流年 2024-12-03 23:21:15

您的应用程序是要创建新用户,并将其添加到聊天列表中,还是要在现有协议(如 IRC、XMPP 等)上使用现有用户(如 Gtalk、Y! Messenger 等)...?

如果您要实现您自己的聊天系统,您的用户将在您的网站上注册,那么您将执行以下操作:

  1. 设置您的网站
  2. 创建协议(即传递消息的方式)
  3. 编写并实现 API(使用 PHP、ASP 等)
  4. 将该 API 与您的 iPhone 应用程序连接。

它是如何运作的?

您保留一个聊天消息表。该表包括:

  1. Chat_From
  2. Chat_To
  3. Chat_Message
  4. Timestamp

您所做的就是,当您启动从 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:

  1. Setup your website
  2. Create a protocol (that's, how you pass messages)
  3. Write and implement an API (in PHP, ASP etc)
  4. Connect that API with your iPhone app.

How it works?

You keep a table of chat messages. The table include:

  1. Chat_From
  2. Chat_To
  3. Chat_Message
  4. Timestamp

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文