I succeeded with the trick of the global variable, put the link here for
completeness:

http://pastebin.com/m3dec9878

Tested and working with APE 1.0

Thanks to everyone for their valuable assistance

Robert

On Fri, Jan 29, 2010 at 5:56 PM, Hugo Vacher <[email protected]> wrote:

> Nicolas just made a little mistake, here is the working (not tested)
> example: http://pastebin.com/m4971e54e
>
> ---------------------------------------------------------------------------------------------
>
> Hugo Vacher, Développeur Web
>
>
> 2010/1/29 Roberto Bottin <[email protected]>
>
> Continue to tell me that myPipe is undefined .....
>>
>>
>> On Fri, Jan 29, 2010 at 5:30 PM, Roberto Bottin <[email protected]
>> > wrote:
>>
>>> ok thanks, I'm going to see the example at the link I've posted
>>>
>>>
>>> On Fri, Jan 29, 2010 at 5:18 PM, Nicolas Trani <[email protected]>wrote:
>>>
>>>> I just posted an example here :
>>>>
>>>> http://pastebin.com/f4d283a0b
>>>>
>>>> Btw this example have some limit if you have multiple channel (it only
>>>> works with one channel).
>>>>
>>>> Cheers
>>>>
>>>>
>>>> Roberto Bottin a écrit :
>>>>
>>>>> Thanks for your reply.
>>>>>
>>>>> I noticed that the problem was there, but I did not know how to solve.
>>>>>
>>>>> Now I wonder, how do I set the variable pipeCreate?
>>>>>
>>>>> I think this is the line you are referring to:
>>>>>
>>>>> client.addEvent ( 'pipeCreate', this.setup);
>>>>>
>>>>> Can you help specifically
>>>>>
>>>>> Thank you very much
>>>>>
>>>>> On Fri, Jan 29, 2010 at 4:43 PM, Nicolas Trani <[email protected]<mailto:
>>>>> [email protected]>> wrote:
>>>>>
>>>>>    Hi,
>>>>>
>>>>>    you are calling pipe.send(); but pipe is undefined in your
>>>>>    function. For example you could define a global var yourPipe that
>>>>>    is set in the pipeCreate event, and use yourPipe.send(); in your
>>>>> link.
>>>>>
>>>>>    Cheers.
>>>>>
>>>>>
>>>>>    serialkiller a écrit :
>>>>>
>>>>>        any idea?
>>>>>
>>>>>        On Jan 29, 10:33 am, Roberto Bottin <[email protected]
>>>>>        <mailto:[email protected]>> wrote:
>>>>>
>>>>>            Yes, Sorry :-)
>>>>>
>>>>>            I'm trying to integrate jquery with APE, the connection is
>>>>>            ok, but I can not
>>>>>            send with pipe.send () from a trivial link.
>>>>>
>>>>>            Can you give me a hand?
>>>>>
>>>>>            This is the code:
>>>>>
>>>>>            function colorChanger(client, debug){
>>>>>
>>>>>                  this.initialize = function(){
>>>>>
>>>>>                          // do the following every time we get a new
>>>>> user
>>>>>                          client.addEvent('pipeCreate', this.setup);
>>>>>
>>>>>                          // when a user joins, update the user list
>>>>>                          client.addEvent('userJoin', this.createUser);
>>>>>
>>>>>                          // when a user leaves, destroy them with
>>>>>            mighty thunder!
>>>>>                          client.addEvent('userLeft', this.deleteUser);
>>>>>
>>>>>                          // when we want to send data
>>>>>                          client.onCmd('send', this.cmdSend);
>>>>>
>>>>>                          // and when we recieve data
>>>>>                          client.onRaw('data', this.rawData);
>>>>>
>>>>>                          var datamicro = new Date();
>>>>>                  var ran = datamicro.getDay()+datamicro.
>>>>>            getMonth()
>>>>>
>>>>>  +datamicro.getFullYear()+datamicro.getHours()+datamicro.getMinutes()
>>>>>
>>>>>  +datamicro.getSeconds()+datamicro.getMilliseconds()+''+Math.round
>>>>>            (9999*Math.random());
>>>>>
>>>>>                          // start the session with a random name!
>>>>>                          client.start({"name":"pippo"+ran});
>>>>>
>>>>>                  }
>>>>>
>>>>>                          $("#invio").click(function(){
>>>>>
>>>>>                                  // get the select box value
>>>>>                                  var color = '#ff9999';
>>>>>
>>>>>                                  console.log('Colore '+color);
>>>>>
>>>>>                                  // set the background of the
>>>>>            document to the color
>>>>>            chosen
>>>>>                                  $("body").css("background-color",
>>>>>            color);
>>>>>
>>>>>                                  // send the new color to the APE
>>>>> server
>>>>>                                  pipe.send(color);
>>>>>                          });
>>>>>
>>>>>                  this.cmdSend = function(pipe, sessid, pubid, message){
>>>>>                          if(debug){
>>>>>                                  alert(message);
>>>>>                          }
>>>>>                  }
>>>>>
>>>>>                  this.rawData = function(raw, pipe){
>>>>>                          if(debug){
>>>>>
>>>>>                          // set the message
>>>>>                          $("#master").html(raw.datas.msg);
>>>>>
>>>>>                          }
>>>>>                  }
>>>>>
>>>>>                  this.createUser = function(user, pipe){
>>>>>
>>>>>                          console.log(user.properties.name
>>>>>            <http://user.properties.name> + ' user enter');
>>>>>
>>>>>
>>>>>                  }
>>>>>
>>>>>                  this.deleteUser = function(user, pipe){
>>>>>
>>>>>                          if (pipe.properties.name
>>>>>            <http://pipe.properties.name>=='test') {
>>>>>
>>>>>                                  console.log('Left channel: ' +
>>>>>            pipe.properties.name <http://pipe.properties.name> +
>>>>>            ' from user: '
>>>>>            + user.properties.name <http://user.properties.name>);
>>>>>
>>>>>
>>>>>  pipe.left(pipe.getPubid());//controllare
>>>>>
>>>>>                          }
>>>>>                  }
>>>>>
>>>>>            }
>>>>>
>>>>>            Thanks
>>>>>
>>>>>            On Fri, Jan 29, 2010 at 10:13 AM, Anthony Catel
>>>>>            <[email protected] <mailto:[email protected]>> wrote:
>>>>>
>>>>>                Hi,
>>>>>                     Sorry can you please speak english? :)
>>>>>                     Anthony
>>>>>                     serialkiller a écrit :
>>>>>                      Sto cercando di integrare APE con jquery, la
>>>>>                connessione avviene, ma
>>>>>
>>>>>                    non riesco ad inviare con pipe.send() da un banale
>>>>>                    link.
>>>>>                           Riuscite a darmi una mano?
>>>>>                           Questo è il codice:
>>>>>                           function colorChanger(client, debug){
>>>>>                                  this.initialize = function(){
>>>>>                                          // do the following every
>>>>>                    time we get a new user
>>>>>                                  client.addEvent('pipeCreate',
>>>>>                    this.setup);
>>>>>                                          // when a user joins, update
>>>>>                    the user list
>>>>>                                  client.addEvent('userJoin',
>>>>>                    this.createUser);
>>>>>                                          // when a user leaves,
>>>>>                    destroy them with mighty thunder!
>>>>>                                  client.addEvent('userLeft',
>>>>>                    this.deleteUser);
>>>>>                                          // when we want to send data
>>>>>                                  client.onCmd('send', this.cmdSend);
>>>>>                                          // and when we recieve data
>>>>>                                  client.onRaw('data', this.rawData);
>>>>>                                          var datamicro = new Date();
>>>>>                          var ran =
>>>>>                    datamicro.getDay()+datamicro.getMonth()
>>>>>
>>>>>  +datamicro.getFullYear()+datamicro.getHours()+datamicro.getMinutes()
>>>>>
>>>>>  +datamicro.getSeconds()+datamicro.getMilliseconds()+''+Math.round
>>>>>                    (9999*Math.random());
>>>>>                                          // start the session with a
>>>>>                    random name!
>>>>>                                  client.start({"name":"pippo"+ran});
>>>>>                                  }
>>>>>                                          $("#invio").click(function(){
>>>>>                                                  // get the select
>>>>>                    box value
>>>>>                                          var color = '#ff9999';
>>>>>                                                  console.log('Colore
>>>>>                    '+color);
>>>>>                                                  // set the
>>>>>                    background of the document to the color
>>>>>                    chosen
>>>>>
>>>>>  $("body").css("background-color", color);
>>>>>                                                  // send the new
>>>>>                    color to the APE server
>>>>>                                          pipe.send(color);
>>>>>                                  });
>>>>>                                  this.cmdSend = function(pipe,
>>>>>                    sessid, pubid, message){
>>>>>                                  if(debug){
>>>>>                                          alert(message);
>>>>>                                  }
>>>>>                          }
>>>>>                                  this.rawData = function(raw, pipe){
>>>>>                                  if(debug){
>>>>>                                          // set the message
>>>>>                                  $("#master").html(raw.datas.msg);
>>>>>                                          }
>>>>>                          }
>>>>>                                  this.createUser = function(user,
>>>>> pipe){
>>>>>                                                            console.log(
>>>>> user.properties.name
>>>>>                    <http://user.properties.name> + ' entrato');
>>>>>
>>>>>                                  }
>>>>>                                  this.deleteUser = function(user,
>>>>> pipe){
>>>>>                                          if (pipe.properties.name
>>>>>                    <http://pipe.properties.name>=='test') {
>>>>>
>>>>>
>>>>>  console.log('Lasciato il canale: ' +
>>>>>                    pipe.properties.name <http://pipe.properties.name>
>>>>>                    + ' da: '
>>>>>                    + user.properties.name <http://user.properties.name
>>>>> >);
>>>>>
>>>>>
>>>>>  pipe.left(pipe.getPubid());//controllare
>>>>>                                          }
>>>>>                          }
>>>>>                    }
>>>>>                           Grazie
>>>>>
>>>>>                --
>>>>>                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]
>>>>>                <mailto:[email protected]>
>>>>>
>>>>>                To unsubscribe from this group, send email to
>>>>>                
>>>>> [email protected]<ape-project%[email protected]>
>>>>>                
>>>>> <mailto:ape-project%[email protected]<ape-project%[email protected]>
>>>>> ><ape-project%[email protected]<ape-project%[email protected]>
>>>>>                
>>>>> <mailto:ape-project%[email protected]<ape-project%[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]
>>>>>    <mailto:[email protected]>
>>>>>
>>>>>    To unsubscribe from this group, send email to
>>>>>    
>>>>> [email protected]<ape-project%[email protected]>
>>>>>    
>>>>> <mailto:ape-project%[email protected]<ape-project%[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]<ape-project%[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]<ape-project%[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]<ape-project%[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]<ape-project%[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/

Reply via email to