您将如何为网站用户群制作即时通讯程序?

发布于 2024-07-30 14:42:29 字数 388 浏览 1 评论 0原文

我有一个设计类似于 myspace/facebook 类型社区的社交网站,我在 LAMP 设置上使用 php/mysql。
我一直想拥有自己的即时通讯工具,可以在用户的​​ PC 上运行,类似于 AIM,可以

与我的网站一起使用,这意味着程序中的好友列表将由我网站上的用户组成,并且还会在旁边显示用户图像

我网站上的姓名和个人资料的链接。

现在我知道这是可能的,但让我不想这样做的是它会占用服务器资源。 所以我想问一下,

如果你要做这件事,你会怎么做?

您会用什么语言来制作 .exe 程序?

有没有办法让一个用户连接到另一个用户,这样他们之间的每条消息都不会到达我的 mysql 数据库?

欢迎任何提示/意见/建议

I have a social network site similar in design to a myspace/facebook type community, I am using php/mysql on a LAMP setup.
I have always wanted to possibly have my own instant messenger that would go on a user's PC similar to AIM that would work

with my site, meanning a buddylist in the program would consist of users on my site and also to show a users image next to

the name and a link to there profile on my site.

Now I know this is possible but what would make me not want to do it is the server resources it would take. So I am asking,

if you were to do this, how would you go about it?

What language would you make the .exe program in?

Is there someway to make a user connect to another user so that each message between them is not hitting my mysql DB?

Any tips/advice/suggestions welcome

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

肩上的翅膀 2024-08-06 14:42:29

使用 JAVA(和 XML)或任何其他语言编写 SOAP(简单对象访问协议)更加容易和快捷。

coding SOAP (Simple Object Access Protocol) using JAVA (and XML) or any other language is much easier and faster.

迷雾森÷林ヴ 2024-08-06 14:42:29

我建议您使用 XMPP,Jabber 的核心协议。

http://xmpp.org/

这是许多网站使用的协议,例如 Google Talk。

如果你想明显地保存日志,你将需要一个数据库。 如果是纯实时的,那么可能不需要通过数据库来存储消息。

如果您只是想在您的网站上使用 ajax 聊天功能,您应该在线搜索,因为有很多这样的功能。 如果您只想要一个通用聊天服务器,只需使用 Jabber 或 IRC。

I recommend that you use XMPP, the core protocol for Jabber.

http://xmpp.org/

It is a protocol that many websites use such as Google Talk.

You will need a database if you want to keep logs obviously. If it is purely real-time, then you may not need to store messages through the database.

If you simply want an ajax chat feature on your website, you should just search online as there are a ton of them. If you simply want an all purpose chat server, just use a Jabber or IRC.

月牙弯弯 2024-08-06 14:42:29

点对点聊天与任何类型的 p2p 系统都有相同的缺陷,那就是几乎每个人都坐在硬件防火墙后面。 实际上,他们都不知道如何更改防火墙规则,更不用说知道如何更改防火墙规则了。

不过,您不必让聊天服务器访问您的数据库。 最简单的聊天协议实际上只不过是某种代理。 客户端A连接到服务器,客户端B连接到服务器,来自客户端A的消息被转发到客户端B。非常快,非常简单,可以处理很多客户端(我们这里说的是数千个)。 我建议您实施有限的消息缓存(例如 5 到 10 条消息),因为当随机消息被丢弃时,很少有事情会让两个聊天的人感到困惑。 缓存一些消息,要求客户端为每条消息发送 ACK 信号……等等。

Peer to peer chats have the same pitfalls as any sort of p2p system and that is that pretty much everyone is sitting behind a hardware firewall. Practically none of them know how to change their firewall rules and even less would anyway.

You don't have to make a chat server hit your DB though. The simplest chat protocol would really be nothing more than a proxy of sorts. Client A connects to server, client B connects to server, message from client A is forwarded to client B. Really fast, really simple, can handle a lot of clients (We're talking thousands here.). I would recommend you implement a limited message cache (say 5 to 10 messages) because few things confuse two people chatting as random messages getting dropped. Cache a few of the messages, demand ACK signals from the clients for every message... etc. etc. etc.

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