Just for information :

You can delay any command using "return -2" :

Ape.registerCmd("foo", true, function(params, cmd) {
    example_async(function() {
cmd.sendReponse("ASYNC_REPLY", {"foo":"bar"}); // (or cmd.user.pipe.sendRaw)
    });

    return -2.
});

Le 15/01/10 16:33, Cadrach a écrit :
Maybe what we should have asked is: Why having the SQL request
processed and the result sent on another raw is an issue for you?

Cadrach

On Jan 15, 3:41 pm, flipkick<[email protected]>  wrote:
you don't want to use synchronous requests because this will block your
whole module with all users until the sql for one user has returned.
and in the idea of cadrach for instance:

while(sqlFinished === false)
{
//waiting loop

}

is horrible, this could use up to 100% cpu only for one user, able to
slow down your whole server just for one single SQL request. there's a
reason why there is no sleep-function in javascript.

get used to asynchronous handling. send the cmd result to the client
when it is available and make the client work with this. in my
rails+ape+mysql-example you'll find a way how you could this, take a
look at
it:http://flip.netzbeben.de/2010/01/howto-create-a-web-chat-with-ape-rai...

flip

Am 13.01.2010 17:28, schrieb nouknouk:

Hi,
I'm currently trying to use MySQL from server side Javascript
framework and I face two issues:
1/ the MySQL binding works in an asynchronous way. But this can be
annoying if you want for example to make a MySQL request into a
command code : as MySQL query is asynchronous, you cannot directly
send a 'command response' to the command sent by the client.
Is there any way to force the use of MySQL binding in an synchronous
way and thus avoid the need to send a 'command response' immediatly,
plus a second raw just after which contains the result of my query.

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