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 data raw (when you receive data from a channel)
ape.onRaw('data', function(param, pipe) {
alert('You received : ' + param.data.msg + ' on pipe ' + pipe.properties.name);
//Send some data to the channel
pipe.send('Hey i just received ' + param.data.msg + '!');
});
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...
