Alright ;)
A pipe is a "thing" where you can send RAWs.
Each user and channels as a pipe. (user.pipe, channel.pipe)
user => "uni"
channel => "multi"
new Ape.pipe() => "custom"
To retrieve the pubid => pipe.getProperty('pubid');
Creating a pipe with "new Ape.pipe()" is really specific. Take a look at
"proxy.js" where there is a use of this custom pipe.
An user can sends a message to a pipe using the "SEND" command with the
following packet :
{"cmd":"send","sessid":"abcd...","chl":1,"params":{"pipe":"pubidofapipe"}}
Create a custom pipe lets you handle this packet :
var mypipe = new Ape.pipe();
achannel.sendRaw('hey', {'msg':'hey guys, there is a new pipe where you
can send something','there':mypipe.getProperty('pubid')});
mypipe.onSend = function(user, params) {
// do something with user and params.
}
You cannot execute a custompipe.sendRaw() like you can execute
channel.pipe.sendRaw(). (At least with the current release).
Client things is not my part. I let somebody else anwser to other
questions ;)
Anthony
Dominik a écrit :
> Hi!
>
>
>> For your first question I think you misunderstood. This article is
>> about "Server-Side javascript", not client side :)
>> APE 1.0 support Javascript module for the server. (Look at your ./
>> APE_Server/scripts/ directory).
>>
>
> Yes, sorry, I meant the APE Log told me that Ape.pipe() ist not a
> function, not the Browser ;)
> I tried new Ape.pipe(), but this also does not give me a valid pipe
> (for example:
> var mypipe = new Ape.pipe();
> --> mypipe.pubid is undefined and mypipe.send is not a function...).
>
> I really don't know what's going wrong there :/
>
> I also do not really understand the "multiPipeCreated"-Event on the
> client side.
> The Move-Demo for example defines:
>
> this.addEvent('multiPipeCreate', function(type, pipe, options){
> if(type=='multi') this.pipe = pipe;
> });
>
> I tried this in my application and it does not work, because type
> never has the value "multi", but is a huge array full of weird
> information.
> The pipe-parameter furthermore does not give me a pipe-object, but is
> an array with information about the userpipes and the channel-pipe.
>
> For example:
> this.addEvent('multiPipeCreate', function(type, pipe, options){
> jQuery("#debug").append("<br>Pipe created");
> alert(pipe.toSource());
> if(type=='multi')
> {
> jQuery("#debug").append("<br>Pipe found");
> this.pipe = pipe;
> }
> });
>
> The alert shows:
>
> ({users:[{casttype:"uni", pubid:"8f30f9d3b67f2c59ae72d0e174e68467",
> properties:{mypipe:"[object pipe]", name:"dominik"}, level:1}], pipe:
> {casttype:"multi", pubid:"41eeb70009b15b1bd81a93e41bcf5fbf",
> properties:{name:"apetest"}}})
>
>
> I'm really confused about this pipe-thing ;)
>
>
>
>> You can avoid this by loading "Sessions.js". With this, every tabs/
>> window you open connect the same user with the same message queue
>> (everything is synchronized).
>>
>
> Works great, thanks!
>
>
>
>
>>> But when
>>> I close one tab, he needs some time to realize that the user has left
>>> (so just realizes it when the open connection of this tab times out).
>>> Is there a way to immediately tell the server that a user has left
>>> when I close a tab/window?
>>>
>> Indeed, some browser don't have a good deal with "onunload" event. So,
>> APE Server can't know when a user left. (You can tune the timeout in ./
>> src/main.h)
>>
>
> Ok, thanks for the info!
>
> Thanks for the help so far!
> Dominik
> >
>
--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---