Got a PrimusError when setting primus server with feathersjs

64 views Asked by At

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?

1

There are 1 answers

0
Joey Yi Zhao On

Fixed that issue by upgrading the version of feathers-primus to 2.0.0 in package.json file as below:

"feathers-primus": "^2.0.0",