BrowserQuest中的websocket-server替换

时间:2015-08-11 19:45:01

标签: node.js websocket npm browserquest

我想让Mozilla的BrowserQuest启动并运行并遇到问题。它取决于websocket-server节点包,不幸的是,它已被弃用并从npm库中删除。

我添加了wsnode-websocket-server个软件包,但它们似乎都不是现有websocket-server调用的简单替代品。

我之前发过的一篇SO帖子说websocket-server替换node-websocket-server package.json,但是在BrowserQuest代码库中现有直接调用websocket-server。< / p>

我还尝试直接更新server/js/ws.js文件,如下所示(添加节点到websocket-server字段):

var cls = require("./lib/class"),
    url = require('url'),
    wsserver = require("node-websocket-server"),
    miksagoConnection = require('node-websocket-server/lib/ws/connection'),
    worlizeRequest = require('websocket').request,
    http = require('http'),
    Utils = require('./utils'),
    _ = require('underscore'),
    BISON = require('bison'),
    WS = {},
    useBison = false;

导致以下错误:

/homenode/browserquest/BrowserQuest/server/js/map.js:15
        path.exists(filepath, function(exists) {
             ^
TypeError: undefined is not a function
    at module.exports.cls.Class.extend.init (/home/node/browserquest/BrowserQuest/server/js/map.js:15:11)
    at Class (/home/node/browserquest/BrowserQuest/server/js/lib/class.js:50:23)
    at module.exports.cls.Class.extend.run (/home/node/browserquest/BrowserQuest/server/js/worldserver.js:151:20)
    at /homenode/browserquest/BrowserQuest/server/js/main.js:79:15
    at Function._.each._.forEach (/home/node/browserquest/BrowserQuest/node_modules/underscore/underscore.js:153:9)
    at main (/home/node/browserquest/BrowserQuest/server/js/main.js:77:7)
    at /home/node/browserquest/BrowserQuest/server/js/main.js:134:13
    at /home/node/browserquest/BrowserQuest/server/js/main.js:117:13
    at fs.js:334:14
    at FSReqWrap.oncomplete (fs.js:95:15)

1 个答案:

答案 0 :(得分:1)

这已更新!我今天也开始工作!!

https://github.com/nenuadrian/BrowserQuest