简体   繁体   English

使用Feathers.js设置Primus Server时出现PrimusError

[英]Got a PrimusError when setting primus server with feathersjs

I followed this link( https://docs.feathersjs.com/real-time/primus.html ) to create a websocket server by feathersjs-primus. 我按照此链接( https://docs.feathersjs.com/real-time/primus.html )通过feathersjs-primus创建了一个Websocket服务器。 Below is the app.configure code I am using: 以下是我正在使用的app.configure代码:

app.configure(primus({
  transformer: 'websocket'
}, function(primus) {
  // Do something with primus
  primus.use('todos::create', function(socket, done){
    // Exposing a request property to services and hooks
    socket.request.feathers.referrer = socket.request.referrer;
    done();
  });
}));

when running this code I got below error: 运行此代码时,出现以下错误:

node_modules/primus/index.js:697
    throw new PrimusError('The plugin is missing a client or server function', this);
    ^

everything I did is following the instruction from the above link. 我所做的一切都是按照上面链接的说明进行的。 Why did I get this error message? 为什么收到此错误消息? What else did I miss? 我还想念什么?

通过将package.json文件中的feathers-primus版本升级到2.0.0来解决该问题,如下所示:

"feathers-primus": "^2.0.0",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM