spread extension for node.js
2010-08-25 08:29
465 查看
一直没有找到支持 spread 的 nodejs 库,周末的时候大致写了一个,基本满足需要 http://github.com/iwater/node-spread
var sys = require('sys'), spread = require('../lib/spread'); var con = new spread.Connection(); con.on('connected', function(){ var self = this; var i = 0; console.log('connected'); self.join('NODE'); setInterval(function(){ var msg = 'NODE' + (i++); console.log('send:' + msg); self.multicast('NODE', msg); }, 1000); setInterval(function () { var msg; while((msg = self.readSync()) != undefined){ console.log('recv:' + msg); } }, 100); }); con.on('error', function(){ console.log('error'+sys.inspect(arguments)); }); con.on('message', function(msg){ console.log(msg); }); con.connect('4803@localhost', 'nodejs1');
相关文章推荐
- nodejs for centos配置
- Building a Redis Sentinel Client for Node.js
- [转]Getting Start With Node.JS Tools For Visual Studio
- Building and running Node.js for Android
- ORM DB for nodejs--sequelize
- Prepare env for Nodejs & Angularjs
- 【phonegap】移动WEB开发--常见问题 Error "There is no script engine for file extension" when running .js files
- Error "Input Error: There is no script engine for file extension ".JS"
- 安装node.js+express for windows的Web开发环境
- nowjs for Node - Directly call remote functions in Javascript
- Simple Sync is a simple sync function-wrapper for node js, based on fibers module.
- Spotlight – Recommend Node.js Projects For January
- 构筑RubyMine IDE开发工具的Coffeescript+node.js开发环境(for windows)
- Learn You The Node.js For Much Win!
- 构筑RubyMine IDE开发工具的Coffeescript+node.js开发环境(for windows)
- There is no script engine for file extension ".js"
- How naive it's to believe node.js good for IO but bad for Computation?
- Where Does Node.js And Require() Look For Modules?
- Simple server side cache for Express with Node.js——Express 实现简单的服务器端缓存【翻译】
- node.js Tools for Visual Studio 介绍