Currently i connect to the db only once, when i start my node application, just after that i load all my models and after that my app is ready to handle any requests via socket.io rpc.
I need to achieve the logic - that if client performs complex request, and if at least one operation failed in chain - for example - all sql requests were done successfully, but email with new password was not sent - rollback everything and show error.
I'm asking, because I remember - in php for example all processes have different connections to db, that's why all transations are independent and can't cross, but for node it's just one process with async requests, that in theory can cross. It's just my first app on node.js.
Is it possible to make with 1 mysql connection for all clients, or i need to connect to mysql, retrieve all models from remote file in each request in socket.io?
I would not recommend doing everything from a single connection. It's a common pattern in Node.js to connect, query, disconnect for each incoming request. If you use request pooling this should be fast enough for most use cases.