Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
APE Event Push SSJS Example
Ape.registerCmd("objectPush", true, function(params, infos) {
//Make sure we have a channel defined
if ( && != null) {
var chan = Ape.getChannelByName(;
if (!chan) return ["401", "UNKNOWN_CHANNEL"];
//Make data optional
if (! { = Array();
//Default Raw if none is givven
if (!params.raw) {
params.raw = 'data';
//Send to the channel. The sender won't receive it.
chan.pipe.sendRaw(params.raw,, {'from': infos.user.pipe});
//If you want the sender to receive what he sent, comment the previous
//line and uncomment this one:
} else {
return 0;
myPipe.request.send('objectPush', {
'raw': 'objectPushed',
'channel': 'testchannel',
'data': {
'content': 'Heyyyy',
'more': 'you!'
ape.onRaw('objectPushed', function (raw, pipe) {
console.log('objectPushed', raw, pipe);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment