Developing chat Module [closed]

I am developing online Chat application in I am facing a problem like suppose there are two users starts communication. When first user write a message in javascript based chat box Then ajax request goes to server. BUt how I open second user chat box so he responce the first user message?



When a user sends a message, an AJAX request will be made to your server and you'll probably save the posted message to a database. You can also have an ajax request made every X seconds that checks for any newly posted messages on the server, and if there are any, it shows them to the user.

Alternatively you can use a technology called Comet, through which your server can 'push' a response to the clients to notify them whenever a new message has been posted.


You should research long polling and web sockets. These allow your clients to have updates pushed to them more effectively. You could poll the server every x seconds, but it would be wasteful of resources.


You might want to have a look at SignalR, an async signaling library for .NET which would be perfect for a chat-application:

Scott Hanselman has a good example on his blog:


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.