![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
nodejs
文章平均质量分 55
biyeah
这个作者很懒,什么都没留下…
展开
-
nodejs+nowjs实现聊天室
支持多房间,支持私聊,使用nowjs库,服务器端代码不到100行。需要jquery1.7.1和coffee-script.js,读者可自行下载。 重点: 1、nowjs中Group的使用,如何遍历Group内的users。 2、客户端如何异步调用服务器端函数。 3、如何与特定用户通信。 运行 [quote]node app.js[/quote] 在浏览器中访问[url]http://...2011-12-13 05:05:31 · 220 阅读 · 0 评论 -
Nodejs中的EventEmitter
EventEmitter是nodejs核心的一部分。很多nodejs对象继承自EventEmitter,用来处理事件,及回调。来看API中的例子 [code="javascript"]var util = require("util"); var events = require("events");//EventEmitter通过events模块来访问 function MyStrea...原创 2011-12-14 04:57:32 · 333 阅读 · 0 评论 -
NowJS and Reconnects
NowJS and Reconnects 保留 原文http://blog.nowjs.com/ This particular feature has been highly anticipated by the NowJS community for some time. With the switch to Socket.IO 0.6.18, which now has built-in...原创 2011-12-14 09:03:07 · 93 阅读 · 0 评论 -
Underscore.js与nodejs相结合
今天发现这个Underscore.js,文档说 [url]http://documentcloud.github.com/underscore/[/url] [quote]Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support th...原创 2011-12-14 11:18:44 · 213 阅读 · 0 评论 -
coffeescript+prototypejs使编写nodejs更象ruby-like
首先安装prototype for nodejs [quote]npm install prototype[/quote] 看个例子 [code="coffeescript"]prototype = require 'prototype' Object.extend global, prototype (9).times (x)-> console.log x [1,...原创 2011-12-21 12:01:11 · 141 阅读 · 0 评论 -
用socket.io实现WebSocket的一个简单例子
[size=large]用socket.io实现WebSocket的一个简单例子[/size] 客户端代码: [code="html"] function doit() { var socket = io.connect('http://localhost'); socket.on...2011-12-07 10:47:29 · 626 阅读 · 0 评论 -
nowjs和nodejs实现服务器端与客户端实时数据传输的例子
参考:[url]http://www.bennadel.com/blog/2171-Realtime-Messaging-And-Synchronization-With-NowJS-And-Node-js.htm[/url] 先说例子实现的功能。网页上有一图片,图片可以拖动。用浏览器打开多个同一网页,当图片移动时,其它页面的图片会同步移动。例子也展示了用jQuery实现图片的拖动。...原创 2011-12-09 03:38:44 · 316 阅读 · 0 评论 -
nodejs运行coffeescript
首先安装coffee-script [quote]npm install coffee-script[/quote] 在js文件中加入下面代码 [code="javascript"]require('coffee-script');//引用coffeescript模块 require('./mytest');//指向要运行的coffeescript文件,可加多个文件。[/code] ...2011-12-10 03:05:58 · 492 阅读 · 0 评论 -
nowjs和nodejs结合的简单示例
功能:把服务器端的时间new Date().getTime()传送到客户端,主要测试实时性。轮询间隔为10ms时,能正常显示。可同时打开多个窗口,设置不同轮询时间,各个窗口可独立运行。 服务器端代码: 用coffeescript编写 server.coffee [code="coffeescript"]fs = require 'fs' url = require 'url' ht...2011-12-10 07:55:15 · 327 阅读 · 0 评论