请问高手csdn论坛的这个实时短信是如何实现的?

liuzhonghe 2003-09-15 10:16:32
如题:原理是怎样的有代码更好,请高手们指点。
...全文
41 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
jiaoyuf2 2003-09-18
  • 打赏
  • 举报
回复
那用定时刷新能不能作一个网上的监视界面阿,就是服务器端有改动,通过定时刷新传到客户端
wangrhliuyh 2003-09-17
  • 打赏
  • 举报
回复
努力學習
liuzhonghe 2003-09-15
  • 打赏
  • 举报
回复
大家还有什么更好的想法,说说看,大家学习一下。
acewang 2003-09-15
  • 打赏
  • 举报
回复
看看这个框架里面的源文件,每过一定时间刷新一次,用脚本控制图片的显示
-------------------
<html>
<head>
<meta http-equiv="Refresh" content="1000;URL=/expert/deeptree/contentbar.asp?myie=ie">
<META NAME="Robots" CONTENT="noindex">
<meta content="text/html;charset=gb2312" http-equiv="Content-Type">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta http-equiv="MSThemeCompatible" content="Yes">

<TITLE>Deeptree Content Bar</TITLE>
<LINK REL="stylesheet" TYPE="text/css" HREF="/csdn.css">
<script src="/Expert/style/get_css.js"></script>
</head>
<script language="javascript">
if (top.location == self.location)
{
top.location.href = "/Expert/Forum.asp";
}

function selectstart()
{
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
function GoToURL(strX)
{
if (strX == "" || strX == null || strX == "undefined")
{
return;
}
window.top.location.href = strX;
}
function mylogin(url)
{
window.parent.parent.location = url+"&from="+window.parent.parent.location.pathname+"&Roomid=&typenum=&tabletype=&searchKeys=&author=&whichpage=";
}
function mylogin2(url)
{
window.open(url+"&from="+window.parent.parent.location.pathname);
newMessage.style.visibility = "hidden";
}
function loginsub()
{
document.login.submit();
}
//-->
</SCRIPT>
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" class="color3">
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<tr>
<td align="left" VALIGN="top" width="100%" NOWRAP>

<div id="showtoc" name="showtoc" style="display:none;">

<table onclick="top.dtbar.showtoc();" align="left" border=0 cellpadding=0 cellspacing=0 title="显示菜单" style="cursor:hand">
<tr>
<td height="30"></td>
<td height="30" valign="middle"><img title="显示菜单" border="0" src="/expert/deeptree/images/showtoc.gif" /></td>
<td height="30"></td>
<td height="30" valign="middle"><a href="#"><font face="verdana" color="#FFFFFF">显示菜单</font></a></td>
</tr>
</table>
</div>
<table border="0" width="100%">
<form method="post" action="/member/logon.asp" target="_top" name="login">
<script>
document.write("<input type='hidden' name='from' value='")
document.write(parent.parent.location)
document.write("'>")
</script>
<tr><td valign="top">
<font color="#ffffff">

<img src="/images/1d.GIF" width="19" height="15">欢迎您:acewang
<img src="/images/1d.GIF" width="19" height="15">可用分:3510
<img src="/images/1d.GIF" width="19" height="15">总信誉分:100
<img src="/images/1d.GIF" width="19" height="15"><a href="/member/logonout.asp" target="_top"><font color="#ffffff">注销我的登录</font></a>
</td><td>

<div id="newMessage" name="newMessage" style="visibility:visible">
<a href="/Message_Board/NewMessage.asp?typestate=0" onClick="javascript:newMessage.style.visibility = 'hidden';" target="_blank" class="Func"><font color="#ffffff">你有短消息</font><img src="/Expert/images/mail.GIF" width="26" height="16" align="absmiddle" border="0"></a><br>
</div>
<bgsound src="/Expert/Deeptree/newMessage.wav" border="0">

</font>
</td></tr></form></table></td></tr></table>
</body>
</html>
xhzuo 2003-09-15
  • 打赏
  • 举报
回复
简单的数据结构:
标号,发信人,收信人,标题,内容,发送时间
使用方法同楼上

wuhaihua 2003-09-15
  • 打赏
  • 举报
回复
发短消息给我,我帮你搞定...
mywisest 2003-09-15
  • 打赏
  • 举报
回复
我也想做一个服务器端推的消息机制,光靠客户端去刷的话,可能服务器负荷会很大,或许这就是CSDN如此慢的原因之一吧!:)
liuzhonghe 2003-09-15
  • 打赏
  • 举报
回复
chnking(kent) 说得不错,明白怎么做了,谢谢
tigerwen01 2003-09-15
  • 打赏
  • 举报
回复
在数据库里创建一张存放消息的表,如just_in_info表,表里必须的字段为存放信息字段(info)、标志信息是否被阅读字段(flag),Y为已阅读N为未读。
当用户下载页面是,首先检测表里的flag字段是否存在未读记录。
liuzhonghe 2003-09-15
  • 打赏
  • 举报
回复
我想错了,我还以为客户不用刷新页面,服务器主动向客户端发送消息呢?如果有信息要重新刷新页面才能看到,这个就会了。呵呵
全当是送分吧,向要分得就来,想说什么就说什么?
chnking 2003-09-15
  • 打赏
  • 举报
回复
短信那一条是一个框架,这个框架中的页面是1000秒自动刷新一次:
<meta http-equiv="Refresh" content="1000;URL=/expert/deeptree/contentbar.asp?myie=ie">

contentbar.asp这个页面中的代码就会到数据库中去查看你的id是否有短信,有了就显示出来。
seesea125 2003-09-15
  • 打赏
  • 举报
回复
消息先写到数据库里,并设置一个标志字段为1,然后你的页面要分帧,其中一个小帧里放一个页面,让它自动定时刷新,
如果监测到数据库里字段为1,则显示有短消息按钮,点击打开,将标志字段设置为0
supercdz 2003-09-15
  • 打赏
  • 举报
回复
先往数据库中插入一条记录 -》 当对方访问页面时 检测是否有记录存在
yjtc 2003-09-15
  • 打赏
  • 举报
回复
学习中。
GaoLun 2003-09-15
  • 打赏
  • 举报
回复
以前的讨论结果,而且我自己也用过的,
http://search.csdn.net/expert/topic/54/5409/2002/11/16/1182351.htm

有谁知道csdn上的短消息是怎么做的!急!!!小女子在此先谢了
rottenapple 2003-09-15
  • 打赏
  • 举报
回复
服务器端的push方法微软几年前提出过,现在不了了之了,服务器主动向客户端发信息不好做,http协议至少是个限制,我认为,除非扩展
liuzhonghe 2003-09-15
  • 打赏
  • 举报
回复
经常刷新网页会增加服务器的负担,大家还有什么好的想法吗?

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧