asp.net - Best way to show "live" comments -


i want show user comments in grid (easy enough) want show new records come in well. in theory, user stays on page while, adding own comments , viewing others' come in.

it behaves chat window multiple users making comments, though don't expect active 1 (i expect intermittently-updated facebook wall)

i've considered: - jquery+ajax+timer?
- web sockets. web sockets ready prime time? , can web sockets implemented asp.net + iis?

i'm looking solution elegant, clean, fast (low bandwidth; load new comments if possible, popping off older ones) , not esoteric on asp.net/iis platform...not sure how go this, kindly requesting help.

thanks!

ps tried searching on "comment system" "show new records" "chat systems", couldn't quite hit results sought.

someone else may have better example, playing around ajax chat web app. here's did using asp.net , jquery.

<script type="text/javascript">     $(document).ready(function () {         $("#btnsend").click(function () {             addmessage();         });         return false;     });      function refreshchat() {         $.get("messages.aspx", function (data) {             $("#chatbox").empty();             $("#chatbox").prepend(data);             var $t = $("#chatbox"); //whatever selector use.             $t.animate({ scrolltop: $t.attr("scrollheight") }, 3000);         });          settimeout(refreshchat, 5000);     }      function addmessage() {         $.get("messages.aspx", { usr: $("#usr").val(), msg: $("#msg").val() });         $("#msg").val('');         $("#msg").focus();     } </script> 

html:

<div id="input">     username:     <input type="text" name="usr" id="usr" /><br />     message:     <textarea rows="3" id="msg" name="msg"></textarea>     <br />     <input type="button" id="btnsend" name="btnsend" value="send" /> </div> <div id="chatbox" style="height: 300px; overflow: scroll;"> </div> 

use message.aspx record new messages database , query new records add msg div.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -