I found the solution - a change was necessary in the server-side
javascript module. The fix is not to pass the pipe - because it isn't
a pipe but a pubid. That was confusing the client on the receiving
end. To the devs on APE, I suggest you correct that in
request.send().
Ape.registerCmd("SEND_HASH", true, function(params, infos) {
Ape.log("Received SEND_HASH");
var pipe = Ape.getPipe(params.pipe);
if (!$defined(pipe)) return ["4400", "WHERESTHEPIPE"];
pipe.sendRaw('HASH_DATA', {type:params.type, id:params.id,
operation:params.operation});
return 1;
On Apr 8, 4:59 am, Martin Drapeau <[email protected]> wrote:
> Let me add the following after further investigation. Question to
> developers follows...
>
> First, I am using JSONP transport.
>
> Second, it seems the function callRaw in Core.js is the issue. I do
> an alert of argument raw and get this:
> {"time":"1270716451","raw":"HASH_DATA","data":{"type":"task","id":
> 88,"operation":"add","pipe":"912ef435321624eba4581b3e4fb8bb1b"}}
>
> Notice that pipe is the pubid. But the code in Core.js callRaw()
> assumes it is an object and attempts to fetch properties form it. But
> that is wrong.
>
> if (raw.data.pipe) {
> var pipeId = raw.data.pipe.pubid, pipe;
> if (!this.pipes.has(pipeId)) {
> pipe = this.newPipe(raw.data.pipe.casttype, raw.data);
> } else {
>
> So is it the raw that is wrong, or is it the callRaw() function that
> is wrong? Any suggestions on how to fix this?
>
> --Martin
>
> On Apr 7, 4:03 pm, Martin Drapeau <[email protected]> wrote:
>
>
>
> > I'm using the latest release (1.0). My onRaw function always receives
> > empty raw and pipe arguments. Yet I can confirm that they are
> > received by looking at the HTTP request headers. But somewhere in the
> > APE JS FrameWork, they get dropped. Can someone help?
>
> > I have the following code on the client side:
>
> > var client = new APE.Client;
> > Planio.ape_client = client;
>
> > client.load({channel:list_id});
>
> > client.addEvent('load', function() {
> > log('Your APE client is loaded');
>
> > var opt = {'sendStack': false, 'request': 'stack'};
> > client.core.start({'name':user_name+Math.floor(Math.random() *
> > 9999999)},opt);
> > client.core.request.stack.send();
>
> > });
>
> > client.addEvent('ready', function() {
> > log('You are connected to APE server. Now you can takeover the
> > world!');
>
> > });
>
> > client.addEvent('multiPipeCreate', function(pipe, options) {
> > Planio.ape_pipe = pipe;
>
> > });
>
> > client.onRaw('HASH_DATA', function(raw, pipe) {
> > log('raw received: '+JSON.stringify(raw));
>
> > });
>
> > client.onCmd('SEND_HASH', function(raw, pipe) {
> > log('send cmd: '+JSON.stringify(raw));
>
> > });
>
> > And this on the server:
>
> > Ape.registerCmd("SEND_HASH", true, function(params, infos) {
> > Ape.log("Received SEND_HASH");
>
> > var pipe = Ape.getPipe(params.pipe);
> > if (!$defined(pipe)) return ["4400", "WHERESTHEPIPE"];
>
> > pipe.sendRaw('HASH_DATA', params);
> > return 1;
>
> > })
--
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/
To unsubscribe, reply using "remove me" as the subject.