socket.io - How to share a Node.JS app state between processes and servers? -
i have node.js application along socket.io manages room system. every time user loads website (that under php+laravel), gets connected node server. store in global map user object, fetched database. in socket connection scope, store current user id. have map stores rooms. room object contains list of users, room_id , other things.
my problem need scale application in multiple processes , multiple servers.
i tried store in redis server using json.stringify. every time user connects, have update redis string , sync other processes.
i thought idea if 2 processes try update redis json string @ time, i'm afraid lose data.
is there better way store shared state ? reactive vue.js store ?
Comments
Post a Comment