I checked this link https://docs.feathersjs.com/real-time/primus.html to setup additional parameters on service method but I didn't figure out how to do it.
Below is my service class:
create(id, shellId, params) {
...
}
below is the primus configuration:
app.configure(primus({
transformer: 'websockets',
timeout: false
}, (primus) => {
primus.library();
primus.save(path.join(__dirname, '../public/dist/primus.js'));
}))
In the manual, it mentions something like below:
primus.use('todos::create', function(socket, done){
// Exposing a request property to services and hooks
socket.request.feathers.referrer = socket.request.referrer;
done();
});
but I am not sure what this function is doing. And also I tried to add above code in my application, I will get socket.request
is undefined error. How to add more parameters on service class in this case?
You can only use the official service methods and their signatures, in the case of
create
it isdata
for the entire data object andparams
for additional parameters. Your service classcreate
looks something like this:On the client you can use it through the Feathers client or a direct Primus connection like this: