How to create a chat application within MODX

Hey all,

Do anyone know if there is a tutorial as to how to build a chat application in MODX? I have been searching online and couldn’t find anything practical. From what I have found, I can build my own chat application in PHP using web sockets (ratchet) but I’m finding it difficult to even create websocket server on shared hosting platform. I’m not familar with Ratchet but there has to be a simply way to a web application…right?

Anyone has any idea where to start? What I need to do? Have done this before?

HI there, I’ll start by the requerimentets itself, for instance I crated a “real time” chat feature for an MODx based app a couple years ago, and honestly didn’t really bother with the sockets part, since there were only up to 50 users connected at the time, so it was basically a mesages table, with the needed asociations, and an endpoint to check for new messages, and another to post messages and that was it, but if you are going to something really big, and that REALLY needs to be real time, you’ll need sockets

Also getting sockets to work on shared platforms can be tricky, and you should probably as your platforms support if its even supported.

Finally, the cool part about MODx, is that beyond being a CMS, its a framework, so you can basically create any code/structure you migth need, and just call it from MODx, as an example, last year we did a process based project, using jBPM along MODx to manage content

I don’t know if this would meet your needs, but MessageManager lets users send messages to each other in the front end individually, or by user group, using the built-in message system in the MODX Manager.

Another thing you might explore is BaseCamp, which includes a somewhat chat-like messaging system, though it does have a monthly, per-user fee.

There is also the Quip extra which handles tree-like discussions in the MODX front-end, though it does not yet work in MODX 3.

As camicase82 suggests, you can build pretty much anything on top of MODX if you have the necessary PHP and/or JS skills.

In case the topic becomes interesting for someone again: If you want to create a websocket based realtime chat, you can use the PECL extension “swoole” to create a websocket on the server side with PHP.

1 Like