In majority of the cases a web based Chat Application is based on either of the following technical solutions.
Figure 1.0
The disadvantages with this solution are:-
What is the Solution?For the solution we need to understand the Life cycle of the request and response.Http request response life cycle in a broader view: - The sequence of action between a browser and server can be shown as below. (Figure 2.0)
Figure 2.0
The SolutionBut imagine a condition where the connection would be kept open between a Client - and Web Server, so that whatever is the new data coming on to the server would be send to the client by the server without client asking for it.And this would be the chat solution. Server updates the client with the new content without client being asking for the new content.
This could be imagining as below. (Figure 3.0)
Figure 3.0
Technically this would be the page which would have a Meta tag would be changed as a page whose page calculation is never completed on the server - and having buffer disabled for the page. The code snippet for the same can be as follows. Response.Buffer=false;While (true){//Is there Any New Content//Send New ContentThread.Sleep (1000); } The complete solution is also available for download.
Response.Buffer=
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: