Answer the question
In order to leave comments, you need to log in
Chat in a heavy symfony project (in any heavy backend engine) - how?
There is a large predominantly content project on any heavy backend engine (symfony, RoR, Django, etc.). For definiteness, let it be symfony (PHP+Mysql+Nginx stack).
Task: to make a chat in one of the subsections of the site. As far as I understand, Node.Js is well suited for these tasks. I am not familiar with Node.JS.
Questions:
1. Is it justified to use these two technologies simultaneously in one project?
2. Does it make sense to make a chat server in PHP+symfony?
3. If you use Node.JS as a chat server, how to implement simultaneous user authentication in the PHP part of the project and the Node.JS part?
4. MySQL - is it reasonable to use it as a DBMS for chat messages? Or is something else better? If different, then how to link it to the existing database in MySQL?
Answer the question
In order to leave comments, you need to log in
1. Yes
2. No. If you need high-quality, fast, and easy chat. And "Yes" if these characteristics are not important to you.
3. I would recommend 2 phase authorization. When the chat server has its own session. And he has a symphony (or vice versa) through RPC, a session is tied to the user.
4. It's better to keep messages in the chat server's memory. If you need logs or moderation, then messages can be uploaded to Muskul. But reading them from there (except for the case with the start of the chat server) makes no sense at all.
PS There are many examples of chat servers on both longPooling and webSocket on node.js. RPC implementations too. Fastening a chat is a matter of a couple of hours (Together with cross-authentication, etc.)
If you choose PHP, take a look at this socketo.me/
Having one technology instead of two can still be justified.
1) Node.js is ideal for such purposes, so I think it's justified. Moreover, there are a lot of ready-made implementations.
2) It all depends on the load. To make a normal chat, you will have to write it using websockets or long-pooling. in any case, the win is not on the php side. Only if you use all sorts of extensions for parallelization, write a demon, etc. It's much easier to set up a Node.js server (even if you're not that good at it). Yes, and writing a reliable server in PHP is another adventure.
3) stackoverflow.com/questions/5741792/node-js-chat-user-authentication
4) again, there are no particular problems. It really depends on the implementation.
1. Why not
2. Depending on what kind of chat. If the load is not large, on normal ajax requests / long-pooling
3. In Symphony, sessions are stored anywhere, by default in files. One domain - one cookie. It remains to duplicate the mechanism for obtaining them.
4. Here I won’t tell you much, but it seems to me that if you don’t hang an index on messages, but only foreign keys on the sender / recipient, everything will be ok
. Take not only what is fashionable, but what you know;)
For organizing chats and other types of push notifications, it is better to use a comet server.
You can give yourself a comparison here cometdaily.com/maturity.html
Or you can use Saas solutions
www.gamooga.com/pricing/
www.tambur.io/pricing
pusher.com/pricing
www.hydna.com/plans-and-pricing/
comet-server.ru/section/10
Do a chat with Nodejs. You can implement a beta in a day. Use socket.io.
Here is a simple example:
www.itlessons.info/nodejs/chat-with-nodejs-and-socket-io-with-auth/ I am
using socket.io in 2 projects. In each, there are approximately 200-500 online. There are no brakes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question