-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined fn app.model.call on client side #1
Comments
You need to ensure you run derby.use(require('racer-rpc')) on the client-side as well. My suggestion is you put it at your root app file (the same file where you run derby.createApp()). Make sure to run it before derby.createApp(), otherwise, it won't work. Let me know how your results. |
Thanks, it works! And now, i have the next error: TypeError: args is undefined at function, when unshift has been called here |
That might actually be a bug. Try returning something from your callback server side and see if it works. In order for me to fix the issue it would be nice if you could paste both your client side call and your server side call here and I'll take a deeper look. |
I want to express my gratitude for help in solving my problem. So, the module racer-rpc works fine and response sends to the event producer (app.model.call) Thanks for helping! |
Happy to help and happy that someone has use for the library! |
Please, help to resolve an issue: Undefined fn app.model.call on the client side
There is a function on the server side to create a store
`function store(derby, publicDir) {
var db = shareDbMongo(process.env.MONGO_URL + '?auto_reconnect=true', {
safe: true
});
derby.use(require('racer-bundle'));
derby.use(require('racer-rpc'));
var redis = require('redis-url');
var pubsub = require('sharedb-redis-pubsub')({ client: redis.connect(), observer: redis.connect() });
var store = derby.createBackend({ db: db, pubsub: pubsub });
store.rpc.on('test-rpc', function (params, callback) { /* some handler here */
callback(null, true);
});
return store;
}`
Call RPC-event on the client side
app.model.call('test-rpc, function (error, result) { });
When call it above, there is an error:
**Reason: app.model.call is not a function**
What has been done wrong?
I tried to repeat the logic you recommend: https://github.com/BBWeb/racer-rpc
The text was updated successfully, but these errors were encountered: