Some years back, I have created a chat application. I can give you details of it.
There was a page with 3 frames. #1 will show a form. #2 will show all the messages of current chat #3 will show the status, howmany members link to details of members etc.
I was using a database just to record the messages and help admin to check them and delete them. A simple chat can use just application object. No need of any database.
The most difficult problem I faced was how to post a new message immediately to the screens of other participants. For this, we should be able to raise an event on client browsers from server. This is not possible however. So I was polling the server at regular intervals to check whether any participant posted a new comment. This was done at a regular intervals of 20 seconds. This polling was done with the help of a page with a meta refresh tag.
The other difficulty was to intimate a person when an other person invites him. Again polling based on meta refresh was used by me.
I do not consider this to be a good method
. It will load the server unnecessarily. Not all browsers will support meta refresh. And this does not seem to be a professional method also.
There should be someway to read a port on client machines through browser. Then there should be some method for server to write something to client machine port. Then this can be done successfully. However a extended search for such features for over a year did not produce any result. Finally I reached a conclusion that chats cannot be successfully built with browsers, ASP and JS
I re-did chat tool with VB
and winsock component. It was meant for intranet alone.
I am telling this not to deject you. My browser based chat tool was working but making our server crash every hour.
May be somebody tell us a way to read a port on client machine through browser. Also to write something to appropriate client browser when some relevant events (new user joins, a member posts a message) happens.