JavaScript 通讯框架 NowJS

jopen 12年前

JavaScript 通讯框架 NowJS
NowJS 是一个实现了 JavaScript 服务器端进行通讯的框架,基于 Node.js 开发。

示例代码:

服务器端:

<script src="/nowjs/now.js"></script> var everyone = require("now").initialize(httpServer);    everyone.now.getServerInfo = function(callback){    db.doQuery(callback);    return "done!" }everyone.now.distributeMessage = function(message){    everyone.now.receiveMessage(this.now.name, message);  }; 

客户端代码:

<script type="text/javascript" src="http://localhost:8080/nowjs/now.js"></script>    <script type="text/javascript">    now.ready(function(){      // alerts "Hello World!"      alert(now.msg);    });  </script>

项目主页:http://www.open-open.com/lib/view/home/1338389788792