Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I trying a simple chat.. by using gridview

whenever i refreshing the page mean only it shows the sender message in gridview..
I used '
<meta http-equiv="REFRESH" content="1" />

my idea is when i enter my cursor into the textbox mean it wont refresh the page.
after pressing the send button mean it will star to refreshing the page..
Posted
Updated 8-Jul-15 18:50pm
v2
Comments
aarif moh shaikh 9-Jul-15 1:35am    
you can use setInterval() in javascript for it.
Arasappan 9-Jul-15 1:57am    
I won't interval.. completely stop the refreshing action
Sergey Alexandrovich Kryukov 9-Jul-15 2:10am    
This is bad approach in principle. Please see Solution 2.
—SA
Arasappan 9-Jul-15 2:23am    
Am just trying... the idea arise on me thank you;
Sergey Alexandrovich Kryukov 9-Jul-15 2:47am    
Sure. You are very welcome.
—SA

1 solution

Development of the Web-based chat system using refreshing the page expecting replies from other player, on timer or some other events is really depressive thing. If there are no updates, it's a waste of traffic, if there are, you may get them a bit too late. It's all wrong. Apparently, Web, primarily based on pure client-server technology (pull technology) and stateless protocol, is purely suited for such an apparent task as chat. For some background, please see my past answer: Application 'dashboard' for website accounts[^].

But some better resolution of the problem does exist: you need server push: http://en.wikipedia.org/wiki/Server_push[^].

These days, such problems as chat systems are pretty typically solved with such a "push" product as SignalR:
https://en.wikipedia.org/wiki/SignalR[^],
http://www.asp.net/signalr[^].

This tutorial shows how to create a SignalR chat application: http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr[^].

This CodeProject article can also be useful: Asp.Net SignalR Chat Room[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900