简体   繁体   English

AJAX即时通讯工具

[英]AJAX Instant messenger

Hi I am trying to make an AJAX instant messenger. 嗨,我正在尝试制作一个AJAX即时通讯工具。 I currently have a website (with user logon, admin area etc.) using PHP, MySql, Java Script etc and an AJAX chat prog with 2 chat rooms (and users in room list etc) and it works really good, but dont really know where to go from here (instant messenger wise). 我目前有一个网站(用户登录,管理区域等)使用PHP,MySql,Java Script等和一个AJAX聊天编程与2个聊天室(和房间列表中的用户等),它的工作真的很好,但不知道从哪里开始(即时信使)。 I have done some researh which has suggested using an AJAX listener for new messages but I cant find much information on it...or if indeed this is needed or i should use something else. 我已经做了一些研究,建议使用AJAX监听器来处理新消息,但是我找不到很多关于它的信息......或者如果确实需要它,或者我应该使用别的东西。 If anyone has any advice where I should go next it would be very, very much appreciated, thanks :) 如果有人对我接下来应该去哪里有什么建议,将非常感谢,谢谢:)

For a chat or chat-like application which needs realtime and immediate responses probably node.js is a way to go. 对于需要实时和即时响应的聊天或类似聊天的应用程序,可能需要使用node.js。 The mentioned socket.io is also built on node.js. 提到的socket.io也是在node.js上构建的。 It can be used both on server and client side. 它既可以在服务器端也可以在客户端使用。

There are lot of blogs/tutorials about node.js. 有很多关于node.js的博客/教程。 Or you may like this , even if it is for a little fee. 或者你可能会喜欢这个 ,即使只是收取一点费用。

I'd suggest taking a look at www.socket.io for the real-time stuff. 我建议你去www.socket.io查看实时内容。

There's even an instant messenger example on the site IIRC. 在IIRC网站上甚至还有一个即时消息示例。

Why dont you go with something like AJAX Chat , it's free and open source! 您为什么不选择AJAX Chat之类的东西,它是免费的开放源代码!

I think it might get you going! 我想它可能会让你前进!

Use Stream Hub. 使用流中心。 Reverse AJAX - pretty cool stuff 反向AJAX - 很酷的东西

You can try cometd of Dojo Foundation! 你可以尝试Dojo Foundation的来吧! http://cometd.org/ http://cometd.org/

Node.js Node.js的

Like a lot of people mentioned I would use node.js/socket.io for this instead of PHP. 就像很多人提到的那样,我将为此使用node.js / socket.io而不是PHP。 It has been created to tackle such sort of problems. 创建它是为了解决此类问题。

Redis Redis的

But if you really want to create somethink like this in PHP I would do it using redis (needs to be installed). 但是,如果你真的想在PHP中创建这样的思考,我会使用redis (需要安装)。 It has blocking list operations which really help you create something like this. 它具有阻止列表操作,可以真正帮助您创建类似的内容。 When some user sents a message to another user we push the message to corresponding blocking list of that user. 当某个用户向另一个用户发送消息时,我们会将消息送到该用户的相应阻止列表。 The user listens to an unique blocking list (key) to receive messages. 用户收听唯一的阻止列表 (键)以接收消息。

Can not install Redis 无法安装Redis

Then you have to use MySQL insert into a table and poll table frequently, but not to much to kill your server/database. 然后,您必须经常使用MySQL插入表和轮询表中,但要杀死服务器/数据库则要花费很多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM