node socket onmessage

  <script src="//cdn.sockjs.org/sockjs-0.3.min.js"></script>
<script>
var sock = new SockJS('http://114.55.72.99:1337/websockets')
, chat = document.querySelector('#chat'); sock.onmessage = function(e) {
var newdiv=document.createElement("div");
var newtext=document.createTextNode("A new div"+e.data);
newdiv.appendChild(newtext) ;
chat.appendChild(newdiv)
};
</script>
上一篇:[原创]java WEB学习笔记45:自定义HttpFilter类,理解多个Filter 代码的执行顺序,Filterdemo:禁用浏览器缓存的Filter,字符编码的Filter,检查用户是否登陆过的Filter


下一篇:【Length of Last Word】cpp