简体   繁体   中英

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. Below is the app.configure code I am using:

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",

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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