-
-
Notifications
You must be signed in to change notification settings - Fork 751
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
different count of arguments in service method from rest api and socket api calling #31
Comments
Just pass the same number of arguments when emitting the SocketIO event by using an empty object as the parameters: var myService = {
get: function(id, params, callback) {
}
}
socket.emit('todo::get', 1, {}, function() {}); You can also write your service method so that it works both ways: var myService = {
get: function(id, params, callback) {
if(!callback) {
callback = params;
params = {};
}
}
}
socket.emit('todo::get', 1, function() {}); |
when i send 4 argument on web browser it not working
socket.io is using xhr-poling
and header the same in both way when i use 3 argument and when 4 arguments and in both type of calling on web browser client, on server i have only 2 arguments on "get" method than i use socket.io client |
I'm not sure I am following here. I just tried it with the example from the website and something like socket.emit('todos::get', 1, {}, function(error, todo) {}) Most definitely works. How does your testpoints service |
I have solve this problem (for me) in my code, but is not work like in documentation. my service get looks
|
What part of the documentation are you referring to? As I pointed out in my comment above TestPointService.prototype.get = function(id, params, callback) {
if(!callback) {
callback = params;
params = {};
}
// Do stuff here
} Should do the same as your solution. I highly recommend however to always use ``js
|
I apologize, |
Ah ok, good to know. Also, if you are interested into open sourcing your Angular wrapper, I'd be happy to hear about it. |
* chore(package): update shx to version 0.3.0 * package-lock.json
* chore(package): update shx to version 0.3.0 * package-lock.json
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs. |
than i create "Services" and use socket client it send 2 arguments to "get" method of Service but than i use REST api it call with 3 arguments?
what i do wrong ?
The text was updated successfully, but these errors were encountered: