nowjs initialize不是一个函数

时间:2016-10-04 03:27:44

标签: javascript express websocket socket.io nowjs-sockets

var express = require('express');
var app = express();
var nowjs = require('now');
app.get('/', function(req, res) {
  res.send('index');
});

var server = app.listen(4000);

/* Initialing now.js for broadcast the functions */
var everyone = nowjs.initialize(server);
everyone.now.sendMessage = function(message) {
  everyone.now.receiveMessage(message);
};

我对nowjs有问题,用这段代码说

var everyone = nowjs.initialize(server);
                     ^
TypeError: nowjs.initialize is not a function

我不知道为什么,我试图在Google上搜索。没有人面对这个问题。

参考:https://github.com/Flotype/now

谢谢你们

1 个答案:

答案 0 :(得分:0)

您可能需要查看此内容 - https://github.com/Flotype/now/issues/208

伤心,不是吗? :(