You could receive this data like:
channel.onRaw("data", function(data){ console.log(data) })
Where 'channel' is the pipe with which you send the command 'foocmd'
through.
On Jun 1, 2011 6:12 PM, "Nicolas" <[email protected]> wrote:
> I now have exatly the same need, but this time not from PHP but from
> the client javacript.
>
> Again, I send a command, and use info.sendResponse to get something
> back. I can deal with the response with the usual this.onRaw()
> function, but I would like to use it straight as an immediate response
> to the request. Is that possible or not?
>
> The doc says:
>
> /*
> * You can return error in two ways:
> * By returning 0 to return a "BAD_PARAMS"
> * By returning an array [code, error] for custom errors.
> */
> Ape.registerCmd("foocmd", true, function(params, info) {
> if (!$defined(params.john)) return 0; // send a "BAD_PARAMS" RAW to
> the user
> if (params.john != "doe") return ["209", "NOT_A_JOHN_DOE"];
> return 1;
> });
>
> Well, ok, so this gives an example of how to return something. But it
> does tell how to receive the response and deal with it.
>
> Pretty simple I believe, but I am stuck here.
>
> Thanks in advance for your time.
>
> Nicolas.
>
>
>
>
>
>
> On 1 juin, 10:51, Nicolas <[email protected]> wrote:
>> Help anyone?
>>
>> On 31 mai, 21:47, Nicolas <[email protected]> wrote:
>>
>>
>>
>>
>>
>>
>>
>> > Hi,
>>
>> > This must be very simple, but I can't make it work. I don't manage to
>> > get any answer from an inline push.
>>
>> > On a PHP file, I write something like many examples I have found
>> > online:
>>
>> > $data =
>> > file_get_contents($APEserver.rawurlencode(json_encode($cmd)));
>> > $data = json_decode($data);
>>
>> > On the APE server, I have registered a command that works fine. It
>> > does receive the signal from the PHP file. However, I added this line:
>>
>> > info.sendResponse('custom_raw', {'foo':'bar'});
>>
>> > so that it sends back an answer to the calling PHP file.
>>
>> > In the PHP file, I tried to find out what was in $data, but it seems
>> > to be completely empty.
>>
>> > What am I doing wrong?
>>
>> > Is it info.sendResponse() that fails, PHP no receiving anything or me
>> > failing to see what is in $data?
>>
>> > Thanks in advance for your help.
>>
>> > Nicolas.
>
> --
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/ape-project?hl=en
> ---
> APE Project (Ajax Push Engine)
> Official website : http://www.ape-project.org/
> Git Hub : http://github.com/APE-Project/
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/