registerHookBadCmd
(since 1.0)
Catch all commands that are not registered
Description
string
registerHookBadCmd
(
function fn )
Register a function to handle all commands that are not already handled.
Parameters
fn
- params - (object) The list of parameters sent by the client.
- info - (object) Contains information about the client (see registerCmd for more informations)
- raw - (string) The raw received
Examples
Log
Ape.registerHookBadCmd(function(params, info, raw){
Ape.log("Bad RAW received ("+raw+").");
//We return nothing so client will receive a BAD_CMD error
});
Forward all
Ape.registerHookBadCmd(function(params, info, raw) {
if(!params.pipe) {
return 0;//We return 0 so client will receive BAD_PARAMS error
}
var pipe = Ape.getPipe(params.pipe);
if(!pipe) {
return [109, 'UNKNOWN_PIPE']; //Client will receive UNKNOWN_PIPE error
}
pipe.sendRaw(raw, params, {from: info.user});
});
User notes
# No comment
Post a note
CollaborAPE to our wiki !
Find the information you need on the APE Official Wiki : Install, Server, JSF, Help...
