S
S
Sam posebe2015-11-22 23:40:41
MySQL
Sam posebe, 2015-11-22 23:40:41

Socket.io, nodejs and mysql how to organize a chat connection?

Node.js + socket.io and mysql how to organize a connection?
I need to make a chat, for this I decided to use a bunch of node.js + socket.io and mysql.
As a database, the choice fell on mysql, because it is used for the site on which the chat will hang. Both node.js and php scripts of the site will work with the tables that will be used for the chat. The site is made on YII freameworke
The question follows from here.
How to organize a connection to the database in node.js, i.e. connect only once and work with the database through this connection or make a connection for each request from the client, perform tedious actions with the database and break the connection.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-11-22
Protko @Fesor

of course the first option. And even better - not one permanent connection, but a whole pool of connections .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question