Assuming that you want it to behave just like the facebook one, then you are going to need to allow a user to log in. They will also need to have a list of people that they can communicate with, so you will need to allow some form of subscription mechanism. Once you have these in place, I find that jQuery generally provides useful plugins to help, and this time is
no exception[
^]; it's free for non-commercial use.