Hi
I've to do an application that send periodically data from server to
browser, using XHRStreaming.
In detail when the server is interrogated, it's answer with a random
number...
This is the client-side code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" dir="ltr"
lang="en">
    <head>
        <title>Mia Applicazione</title>
        <script type="text/javaScript" src="../../Source/mootools-
core.js"></script>
        <script type="text/javaScript" src="../../Clients/
MooTools.js"></script>
        <script type="text/javaScript" src="../config.js"></script>
        <script type="text/javaScript" src="../../Source/Core/
Core.js"></script>
        <script type="text/javaScript" src="../../Source/Transport/
Transport.XHRStreaming.js"></script>
        <script type="text/javaScript" src="../../Source/Transport/
Transport.SSE.js"></script>
   </head>
<body>
<script type="text/javaScript">
var client = new APE.Core({
                   'server': 'ape.local.ape-project.org:6969',
                   'identifier': 'Miaapp',
                   'transport': 1, //Metodo di trasporto usato da APE
                   'frequency': 3
});

            //Load APE Core
            client.load({
                   'domain': 'local.ape-project.org',
                   'server': 'ape.local.ape-project.org:6969',
                   'scripts': ['local.ape-project.org/APE_JSF/Build/
uncompressed/apeCore.js'],
                   'connectOptions': {'name': 'anotherApeUser'}
});
            //Intercept 'load' event. This event is fired when the
Core is loaded and ready to connect to APE Server
            client.addEvent('start', function() {
                //Call the core start function to connect to APE
Server
                client.core.start({"name":prompt('Inserisci un
nome?')});
            });
        //4) Listen for the ready event to know when your client is
connected
        client.addEvent('ready', function() {
                //1) join 'testChannel'
                client.core.join('testChannel');
                //2) Intercept multiPipeCreate event
                client.addEvent('multiPipeCreate', function(pipe,
options) {
                //3) Send the message on the pipe
                client.request.send("getcount", {ping: "ciao"});
                });
                //4) Intercept receipt of the new message
                client.onRaw("COUNT", function(raw, pipe) {
                    document.write("valore ricevuto:" + raw.data.val);
                });
            });

</script>
</body>
</html>

and this is the server-side code:
Ape.registerCmd( "getcount", false, function(params, cmd) {
        var num = Math.floor(Math.random()*100);
        cmd.sendRaw("COUNT", { val: "num",
                                    echo: params.ping
                                  });
});
Someone knows because it's not work.....Help me please!!

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