-
-
Save Marak/321406 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.someMethod = function (arg1, arg2, callback) { | |
// Do this for safety's sake, people might accidentally send us an extra arg | |
arg1 = arguments[0]; | |
arg2 = arguments[1]; | |
callback = arguments[arguments.length - 1]; | |
callback(null, 'win!'); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The call | |
{ | |
"method": "someMethod", | |
"params": [ arg1, arg2 ], | |
"id": new Date().getTime() | |
} | |
// The response | |
{ | |
"id": 12345, // The date we sent | |
"result": "win!", | |
"error": null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment