now

NowJS makes it easy to build real-time web apps using JavaScript

  • 所有者: Flotype/now
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Get NowJS http://www.nowjs.com/

###NowJS makes realtime web apps really easy.

Go to Github or
Download the master tgz

Install From npm

npm install now or npm install now -g to install globally

NowJS is a Node.js module. The client javascript (now.js) is served by the NowJS server.

NowJS uses the excellent socket.io and node-proxy libraries.

2 Step Setup

1. On the server

var httpServer = require('http').createServer(function(req, response){ /* Serve your static files */ })
httpServer.listen(8080);

var nowjs = require("now");
var everyone = nowjs.initialize(httpServer);

everyone.now.logStuff = function(msg){
    console.log(msg);
}

2. On the client

FAQ

Q: Can I pass in a callback or closure, for example, if the remote function is asynchronous?

A: Yes. This is 100% supported

Q: How do I use NowJS with Express?

A: Very easily.

var app = express.createServer();
var server = app.listen(3000);
var everyone = require("now").initialize(server);

Q: How do I disable WebSockets or only use xhr-polling?

A: You can specifiy exactly which transports to use as an initialization options as follows:

var nowjs = require("now");
var everyone = nowjs.initialize(yourHttpServer, {socketio: {transports: ['xhr-polling', 'jsonp-polling']}});

*Q: Error: " SyntaxError: Unexpected token " / Can I statically host the now.js file?

A: On the client side, make sure you link to now.js like this

 <script src="http://myserver:myport/nowjs/now.js"></script>

You do not need to host the file /nowjs/now.js. It is automatically hosted by the NowJS using the http server you pass into the .initialize(...) in your server code. If you choose to host now.js yourself, you can, but do not use the version in github repo you MUST save the file at http://myserver:myport/nowjs/now.js and host that, because it is automatically configured for your server.

Further Reading

Now that you have NowJS, try the NowJS User Manual and Quick Chat Example

Have more questions? Please contact us:
Email: team@nowjs.com

IRC: #nowjs on freenode

Twitter: @NowJSTeam

主要指標

概覽
名稱與所有者Flotype/now
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2011-03-02 20:34:14
推送於2017-04-18 05:56:17
最后一次提交2012-04-22 19:39:10
發布數14
最新版本名稱0.8.1 (發布於 2012-01-17 00:41:26)
第一版名稱0.5.0 (發布於 )
用户参与
星數1.9k
關注者數53
派生數172
提交數309
已啟用問題?
問題數196
打開的問題數40
拉請求數11
打開的拉請求數2
關閉的拉請求數20
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?