Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (5.6k points)
I have a socket.io chat room whose traffic is increasing, and now we are looking to grow our capacity with multiple nodes. So will the ALB automatically redirect my messages?

1 Answer

0 votes
by (12.4k points)
edited by

Yes, ALB will load balance the users but need to add code as users will be distributed within different servers.

var io = require('socket.io')(3000);

var redis = require('socket.io-redis');

io.adapter(redis({ host: 'localhost', port: 6379 }));

Also, enable sticky session in ALB, or else socket.io handshake will fail

Want to learn more about ALB, Come and join:  AWS Course

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...