Helo,
here's Luca from Italy...

Sorry for my bad english :-)

So, I need some help..I created a new module (in C) that Hanles a new
command "OPERATOR_LOAD_APP";
the command takes 2 parameters, where 2 of 3 are MY PARAMETERS
( app_name and channel_id) and the 3rd is the sessionid

The command (GET) sent by the client is like this:

http://0.ape.lunard.local/?OPERATOR_LOAD_APP&371ba94ba2735fa18e4f87dd0c9dc465&aaa&testchannel&1255258760904

I registered the command and this works well:

register_cmd("OPERATOR_LOAD_APP", 3, cmd_operator_load_app,
NEED_NOTHING, g_ape);

The method  cmd_operator_load_app does some checks (the appName
exists, the channel exists, etc) and then should send a RAW:

static unsigned int cmd_operator_load_app(callbackp *callbacki)
{
        CHANNEL *jchan;
        char *app_name;
        int app_ok = 1;

        // Veryfy (eg on DB) if the requested Application Name (callbacki-
>param[1]: app_name) exists

        if(DEBUG)
                if(DEBUG)
                        printf("%s\n","cmd_operator_load_app..");

        if ((jchan = getchan(callbacki->param[3], callbacki->g_ape)) == NULL)
{ // verifico se il canale esiste!
                SENDH(callbacki->fdclient, "ERR NOT_A_CHANNEL", 
callbacki->g_ape);
                if(DEBUG)
                        printf("ERR NOT_A_CHANNEL \n");

        } else {

                // recupero il nome dell'applicazione che si vuole caricare
                app_name = callbacki->param[2];

                if(DEBUG)
                        printf("app_name = %s\n",app_name);

                // controllo se l'applicazione esiste!

                if(app_ok){
                        // send_msg_channel(CHANNEL *chan, const char *msg, 
const char
*type, acetables *g_ape);
                        // NB: type e' il "typo" di RAW, che alla fine viene 
utilizzato
nella funzione 'raw_froge' per costruire il RAW;
                        //     nella specifica del RAW indicata all'URL
http://www.ape-project.org/wiki/index.php/RAW, 'type' e' di fatto il
'value' del RAW
                        //     Da controllare meglio..

                        send_msg_channel(jchan, app_name, RAW_CLIENT_LOAD_APP, 
callbacki-
>g_ape);
                        SENDH(callbacki->fdclient, "OK POSTED", 
callbacki->g_ape);

                }else{
                        // l'applicazione NON esiste!
                        // invio un messaggio con la notifica
                }
        }
        return (FOR_NOTHING);
}


On the client I try to catch the raw (using the client JavaScript.js)
but NOTHING HAPPENS!



client.load({
                 'domain': APE.Config.domain,
                 'server': APE.Config.server,
                 'identifier': 'jquery',        // A unique identifier. 
Basically used so
you can run multiple APE apps on one page and distinguish between
them.
                 'channel': 'testchannel',              // Sata is transmitted 
through channels
and users can join these channels to send/receive updates – a bit like
IRC.
                 'complete': function(ape){     // Here we can initialize our
application.
                     // APE has finished loading so now we can load our scripts

                     if(debug)
                         $("#debug").append("<span><strong>"+(new Date())+" - 
APE
has finished loading</strong></span><br />");

                    // utilizzo l'oggetto 'ape' passato come parametro nel 
Handler
                    new APE_Handler(ape, debug).initialize();

                 },
                 'scripts': APE.Config.scripts //Scripts to load for APE JSF
             });

          // creo l'oggetto (Wrapper) che andro' ad utilizzare con gli eventi
APE
         function APE_Handler(ape, debug){
                this.initialize = function(){
                   // mi abbono agli eventi:

                ..
                ..

                   // ricevuta una richiesta di caricamento di un'app
                   ape.onRaw('CLIENT_LOAD_APP', this.rawLoadApp);

                   ape.addEvent('OPERATOR_LOAD_APP', this.loadAppEvent);

                    // avvio la sessione con un nome random
            ape.start(String((new Date()).getTime()).replace(/\D/
gi,''));
                }

                this.setup = function(type, pipe, options){
                         $("#debug").append("<span><strong>"+(new Date())+" - 
Pipe created</
strong></span><br />");

                        ..

                        $("input[name=bntLoadApp]").click(function(){

                             // recupero il nome dell'applicazione
                            appName = $("#txtAppName").val();
                                alert("'"+appName+" load request..");
                                if(appName!=""){

                                        pipe.core.request('OPERATOR_LOAD_APP', 
[appName, 'testchannel'],
true);
                                 }
                         });
                }



                this.rawLoadApp = function(raw, pipe){
                      // data has been received by the APE server so do the
following...
                      if(debug)
                         $("#debug").append("<span>   "+(new Date()) + " - " +
raw.datas.sender.properties.name + " ha richiesto il caricamento
dell'applicazione '" + raw.datas.msg + "'</span><br />");
                 }

           ..

Someone can help me ???

Thanks!

--~--~---------~--~----~------------~-------~--~----~
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