PHP即时消息传递方法

编程入门 行业动态 更新时间:2024-10-23 19:35:15
本文介绍了PHP即时消息传递方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想制作一个IM,以便用户可以像聊天一样在同一页面上向彼此发送即时消息.用户可以选择可以看到其消息的人.它用于任务管理.我应该使用的最佳方法是什么?我正在使用php. php套接字对此有用吗?或轮询,Comet,php输出缓冲区或javascript计时器(计时器很简单,但并不快).

I want to make an IM so that user's can send instant messages to each others on the same page like a chat. Users can choose that who can see their messages. Its for task management . What is the best method that I should use for. I'm using php. Is php sockets usefull for this? or Polling, Comet, php output buffer or javascript timer(timer is easy but not fast).

推荐答案

最常用的方法称为 COMET .

这是一个PHP实现:如何使用PHP实现COMET

Here is a PHP implementation: How to implement COMET with PHP

在HTML5规范中,已经有许多浏览器实现了所谓的Websocket.这是一个支持websocket的PHP项目: phpwebsocket .如果浏览器不支持websocket(因此向后兼容),则有一些javascript库可以使用Flash组件

In the HTML5 specification there are something called websockets that many browsers already have implemented. Here is a PHP project supporting websockets: phpwebsocket. There are some javascript libraries which can use a flash component if the browser do not support websockets (and therefore be backwards compatible)

imho webSockets是可行的方法,尽管PHP可能不是最适合处理它们的后端.

imho webSockets is the way to go, although PHP might not be the most suitable backend to handle them.

更多推荐

PHP即时消息传递方法

本文发布于:2023-11-05 12:38:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560864.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:即时消息   方法   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!