2011-11-01 20:01
浏览 72


I'm thinking of integrating a chat inside an already written and working php application. As I have to choose the chat implementation yet I'll show you some consideration:

  1. PHP is not good for Comet application. A php comet server for managing chat would not scale well, so it wouldn't be my first choice.
  2. Node.js + Socket I/O, can eventually be a good option for the chat engine.
  3. AMQP (RabbitMQ?) can be another possibly good solution, not exclusive with node.js as they can integrate pretty well.

The main problem is: how can I avoid code and business logic duplication? There are some aspects I'd like to point out:

  • The application manages users in a RBAC fashion. Users should be able to chat with other users depending on their role (and some other business logics). It would be hard (and bad practice imo) to duplicate that logic.
  • If I use two different server processes (as I think) for IM and application, how can I manage http session?

In short: IM would be tightly coupled with business logic, so I really need to avoid code/logic duplication, but at the same time I don't want a PHP chat engine.

Thank you in advance.

图片转代码服务由CSDN问答提供 功能建议

我正在考虑在已经编写和正在运行的php应用程序中集成聊天。 我必须选择 聊天实现,但我会给你一些考虑:

  1. PHP对Comet应用程序不利。 用于管理聊天的php彗星服务器不能很好地扩展,因此它不是我的首选。
  2. Node.js + Socket I / O,最终可以成为聊天引擎的一个很好的选择 。
  3. AMQP(RabbitMQ?)可能是另一个可能很好的解决方案,不是node.js独有的,因为它们可以很好地集成。 < p>主要问题是:如何避免代码和业务逻辑重复? 我想指出一些方面:
    • 应用程序以RBAC方式管理用户。 用户应该能够根据其角色(以及其他一些业务逻辑)与其他用户聊天。 复制该逻辑很难(也可能是不好的做法)。
    • 如果我为IM和应用程序使用两个不同的服务器进程(我认为),我该如何管理http会话?

      简而言之:IM会与业务逻辑紧密结合,所以我真的需要避免代码/逻辑重复,但同时我不想要PHP 聊天引擎。


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douzhuiqiu4923 2011-11-01 20:03

    I am using something in my php application called Pusher

    Here is the Link for Pusher

    打赏 评论

相关推荐 更多相似问题