onRaw

(since )



Intercept a raw

Description


string onRaw ( string type, function fn )

Execute a function when a raw is received and pass to the function the data received from the server.

If the received raw is related to a pipe (e.g : you receive data from a channel) the second arguments will be a pipe object.

Parameters


type
Name of the raw (e.g : 'login', 'data');

fn
Callback function to execute
  • args - (object, optional) An object containing all data sent by the server.
  • pipe - (object, optional) If the request is made on a pipe (e.g : you sent data to a channel) the second argument will be a pipe object.

Examples


//ape var is a reference to APE instance
 
 
//Intercept login raw.
ape.onRaw('login', function(param) {
    alert('You are now connected to APE! with sessid' + param.data.sessid);
});

See also


  • RAW » This page covers APE protocol 1.0 = APE Protocol Basics = == Request to s... (Wiki)
  • RAW » [[Category:Protocol]] Data sent from server to client is called a '''RAW'''. Custom RAWs can be cr... (Wiki)

User notes


# No comment

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.