Thanks for the replies. What I need is not a realtime messaging system, also that is something I have in mind for future extensions -- so still helpful, thanks.
My need is more like an emailing system where each user will have an inbox, sent and trash folder, and messages are shown in a thread form. So in the inbox page, you see the list of all the messages you've received, and if you click on one, all the corresponding to that particular message appears. Thanks --