Home » Docs » Server »
 

sendResponse

(since 1.0)



Send a response to a command.

Description


sendResponse ( string name, object data )

You can send a response in registerHookCmd and registerCmd. This is useful if you want to assign a callback to a command in client-side.

Parameters


name
The raw name

data
An object that will be JSON encoded and sent with the raw.

Examples


Ape.registerCmd("foocmd", true, function(params, infos) {
	infos.sendResponse('custom_raw', {'foo':'bar'});
});

User notes


Anshul
Anshul said:
When calling sendResponse method, the RAW sent to the user has the challenge 'chl' set to the value that came in the request to facilitate a callback.

Other methods of sending a response includes pipe.sendRaw however server doesn't set the 'chl' automatically for them
02/08/10 11:07

Post a note


User notes may be edited or deleted, and usually a note is deleted because of the following reasons:
  • Bugs: Instead report a bug
  • Missing documentation: report that as a bug.
  • Support questions: See the community for available options.

In other words, do not ask questions within the user notes.

Note <b>,<u>,<i> HTML tags are allowed in the posts and the note formatting is preserved. URLs will be turned into clickable links, JavaScipt and C code blocks enclosed in the <source="javascript">JS Code</source> and <source="c">C Code</source> tags will be source highlighted automatically.