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 + ' user enter');

       }

       this.deleteUser = function(user, pipe){

               if (pipe.properties.name=='test') {

                       console.log('Left channel: ' + pipe.properties.name +
' from user: '
+ user.properties.name);
                       pipe.left(pipe.getPubid());//controllare

               }
       }
}






Thanks





On Fri, Jan 29, 2010 at 10:13 AM, Anthony Catel <[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 + ' entrato');
>>
>>        }
>>
>>        this.deleteUser = function(user, pipe){
>>
>>                if (pipe.properties.name=='test') {
>>
>>                        console.log('Lasciato il canale: ' +
>> pipe.properties.name + ' da: '
>> + 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]
> 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