feathersjs应用程序中的嵌入式节点red获取websocket错误

feathersjs应用程序中的嵌入式节点red获取websocket错误,websocket,node-red,feathersjs,Websocket,Node Red,Feathersjs,我可以通过以下node-red.service.js将node-red嵌入到自定义服务中: // Initializes the `node-red` service on path `/red` const { NodeRed } = require('./node-red.class'); const hooks = require('./node-red.hooks'); const RED = require("node-red"); module.exports = function

我可以通过以下node-red.service.js将node-red嵌入到自定义服务中:

// Initializes the `node-red` service on path `/red`
const { NodeRed } = require('./node-red.class');
const hooks = require('./node-red.hooks');
const RED = require("node-red");

module.exports = function (app) {

  const paginate = app.get('paginate');

  const options = {
    paginate
  };

  // Create the node-red settings object
  const settings = {
    httpAdminRoot:"/red",
    httpNodeRoot: "/red",
    userDir:  "./red",
    functionGlobalContext: { }    // enables global context
  };

  // Initialise the runtime with a server and settings
  RED.init(app,settings);

  // Serve the editor UI from /red
  app.use('/red' , RED.httpAdmin );
  RED.start()


};
如果我转到localhost:3030/red,我会看到节点红色页面,但几秒钟后,它与服务器失去了连接,出现以下错误:

WebSocket connection to 'ws://localhost:3030/red/comms' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
我认为通过websocket提供服务存在问题,或者可能是因为feathersjs中没有定义/red/comms,所以无法连接。有什么想法吗


谢谢

这一问题与这一行有关:

 // Initialise the runtime with a server and settings
  RED.init(app,settings);
正如注释所说,您需要使用服务器对象初始化运行时。在这里,您传递的是一个Express应用程序,而不是服务器

无法在express app Node上装载websocket侦听器-RED需要访问底层HTTP服务器对象

我不熟悉featherjs提供的API,但它确实允许您访问http服务器对象-例如,通过调用
app.listen
yourself-