我有一臺(tái)阿里云服務(wù)器 上面部署了web-msg-sender-master 啟動(dòng)成功 本地調(diào)用 返回值ok 然后我再另外一個(gè)ip的服務(wù)器上寫(xiě)上推送的代碼(這個(gè)index.html 驗(yàn)證過(guò)同ip下可用 ) 現(xiàn)在另外一臺(tái)ip的項(xiàng)目無(wú)法接收到推送消息 請(qǐng)問(wèn)我怎么寫(xiě)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link href="main.css" rel="stylesheet" type="text/css" />
<script src='//cdn.bootcss.com/socket.io/1.3.7/socket.io.js'></script>
<script src='//cdn.bootcss.com/jquery/1.11.3/jquery.js'></script>
<script src='/notify.js'></script>
</head>
<body>
<div class="notification sticky hide">
<p id="content"> </p>
<a class="close" href="javascript:"> <img src="/icon-close.png" /></a>
</div>
<div class="wrapper">
<div style="width:850px;">
<h3>介紹:</h3>
<b>Web-msg-sender</b> 234是一個(gè)web消息推送系統(tǒng),基于<a rel="nofollow" >PHPSocket.IO</a>開(kāi)發(fā)。<br><br><br>
<h3>支持以下特性:</h3>
<ul>
<li>多瀏覽器支持</li>
<li>支持針對(duì)單個(gè)用戶推送消息</li>
<li>支持向所有用戶推送消息</li>
<li>長(zhǎng)連接推送(websocket或者comet),消息即時(shí)到達(dá)</li>
<li>支持在線用戶數(shù)實(shí)時(shí)統(tǒng)計(jì)推送(見(jiàn)頁(yè)腳統(tǒng)計(jì))</li>
</ul>
<h3>測(cè)試:</h3>
當(dāng)前用戶uid:<b class="uid"></b><br>
可以通過(guò)url2222:<a id="send_to_one" hreasf="" target="_blank"><font style="color:#91BD09">http://<font class="domain"></font>:2123?type=publish&to=<b class="uid"></b>&content=消息內(nèi)容</font></a> 向當(dāng)前用戶發(fā)送消息<br>
可以通過(guò)url:<a target="_blank"><font style="color:#91BD09">http://<font class="domain"></font>:2123?type=publish&to=&content=消息內(nèi)容</font></a> 想所有在線用戶推送消息<br>
<script>
// 使用時(shí)替換成真實(shí)的uid,這里方便演示使用時(shí)間戳
var uid = Date.parse(new Date());
$('#send_to_one').attr('href', 'http://123.57.47.152:2123/?type=publish&content=%E6%B6%88%E6%81%AF%E5%86%85%E5%AE%B9&to='+uid);
$('.uid').html(uid);
$('.domain').html(document.domain);
</script>
</div>
<script>
$(document).ready(function () {
// 連接服務(wù)端
var socket = io('http://123.57.47.152:2120');
// 連接后登錄
socket.on('connect', function(){
socket.emit('login', uid);
});
// 后端推送來(lái)消息時(shí)
socket.on('new_msg', function(msg){
$('#content').html('收到消息:'+msg);
$('.notification.sticky').notify();
});
// 后端推送來(lái)在線數(shù)據(jù)時(shí)
socket.on('update_online_count', function(online_stat){
$('#online_box').html(online_stat);
});
});
</script>
<div id="footer">
<center id="online_box"></center>
<center><p style="font-size:11px;color:#555;"> Powered by <a href="http://www.wtbis.cn/web-sender" target="_blank"><strong>web-msg-sender!</strong></a></p></center>
</div>
</body>
</html>