Create one to one chat app like gmail or facebook

how can i create chat app like gmail or facebook or signalr

should i use stream

i want to send message from one user to another using popup window

which is a div and it prepends on click of online user list

for that i have used a div in a footer and a user list in sidebar which makes it available to any page or template

on click on user in database a roomid is create with the users array for both the users
if allready exist then gets the roomid

and on click it also prepends div but the problem is how can prepend this to other user which is going to receive the chat

is there any way like token or stream

thank you