Syl
Syl

Reputation: 2232

PHP WebSocket Chat: private conversation

I tried that code: http://www.flynsarmy.com/2012/02/php-websocket-chat-application-2-0/ and it works very fine. But that's not really what I looked for.

That code creates a "room", with only one "instance" of websocket. I would like to have as much instances as "one-to-one conversations" like FB.

Someone has any idea how to make privates conversations websocket's chat?

tl;dr: if there are 3 conversations (6 people), I would like to create automatically 3 "rooms".

Thank you so much.

Regards

Upvotes: 0

Views: 3743

Answers (1)

devnull69
devnull69

Reputation: 16564

This could still be handled by one websocket server instance. You'll just have to store for each user1 the corresponding user2. Everytime user1 sends a message it will be forwarded only to user2 and vice versa. To avoid redundant data, you should store the relation between user1 and user2 only once, of course.

Upvotes: 1

Related Questions