node.js - How to make a nodejs with socketio cluster? -


i write chat app nodejs, express , socketio. support chat in 1 room, , support multiple rooms, , hold client data in memory, such there global variable rooms, , store client data this..

var rooms =  {   "room1": [          {username: "user1", socket: user1socket},           {username: "user2", socket: user2socket},    ],   "room2": [          {username: "user3", socket: user3socket},           {username: "user4", socket: user4socket},    ] } 

but there multiple serverss in cluster, client didn't know connect server, because job of load equalizer, problem occured, user1 , user2 should in same room, may connect different server..

what shall do?

you need configure servers redisstore. have here more information: https://github.com/learnboost/socket.io/wiki/configuring-socket.io#server


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -