[英]What's the best way to implement a Live chat system on my webserver?
I'm interested in something based on Jabber but I didn't find a free/opensource one so I'm thinking of writing one. 我对基于Jabber的东西感兴趣,但我没有找到一个免费/开源的,所以我想写一个。
I've installed a Jabber server and now thinking about the ways in which I can write the client. 我已经安装了一个Jabber服务器,现在正在考虑我可以编写客户端的方式。 I'm thinking of one of either these two methods.
我正在考虑这两种方法中的一种。
1) An ajax call made to a jabber script running on the webserver that takes care of connecting to the server. 1)对在web服务器上运行的jabber脚本进行ajax调用,该脚本负责连接到服务器。 But then I thought because of the dependencies involved in the jabber client, it might end up consuming too much memory when a few clients connect.
但后来我想,由于jabber客户端中涉及的依赖关系,当一些客户端连接时,它可能最终消耗太多内存。
2) The other method is to run a client running as a daemon that takes care of all the heavy lifting. 2)另一种方法是运行一个作为守护进程运行的客户端来处理所有繁重的工作。 This way I need to have only one instance of the client that sends a spoofed message (sender's name as that of whatever the user entered on the site).
这样我只需要一个客户端实例发送一个欺骗性消息(发件人的名字就像用户在网站上输入的那样)。 A simple script running on the webserver talks to this daemon over some sort of API (XMLRPC or Msgpack maybe?)
在Web服务器上运行的一个简单脚本通过某种API(可能是XMLRPC或Msgpack)与该守护进程通信?
I think #2 is better but I'm not sure. 我认为#2更好,但我不确定。 Are there other ways I can implement this?
还有其他方法可以实现吗? I'm considering using Perl or Python for this.
我正在考虑使用Perl或Python。
Jabber is usually called XMPP nowadays, and there are dozens of clients and servers, something for every language. Jabber现在通常被称为XMPP,并且有许多客户端和服务器,适用于所有语言。 If you are using Javascript (you mention Ajax), you probably want Strophe .
如果你使用Javascript(你提到Ajax),你可能想要Strophe 。 Most servers are modular, so you only load the features you need (consider Tigase, ejabberd, or xmpppy).
大多数服务器都是模块化的,因此您只需加载所需的功能(考虑Tigase,ejabberd或xmpppy)。 Writing your own is even worse an idea than it sounds.
写自己的想法比听起来更糟糕。
Or you could consider installing node.js to create your chat system using socket.io . 或者您可以考虑安装node.js以使用socket.io创建聊天系统。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.