node.js - how to create a room based on 2 users in socket.io? -
my goal create 1 one chat based on 2 different users. way think of use socket.io rooms
but problem right how create unique room?
for example
socket.on('join', function(room) { socket.join(room); });
do need emit room client, if , how make unique. imagine there thousands of users.
the chat application, similar facebook chat application. can chat 1 on one.
do need redis or mongodb store room? of have experience using socket.io in scale, please share opinion
thanks!
i tried minimal example of can in 1 room @ time (apart default socket.id
room) , other sockets in same room receive messages. can change rooms.
the basic premise is, if socket in room 'xyz' , socket b, on server side can socket.to('xyz').emit('message', 'hello')
socket a, , socket b receive message, connected socket c isn't in room 'xyz' won't.
Comments
Post a Comment