Hi,

I know this is more Javascript than APE question, but I hope someone has a
simple solution to the flowing problem:

Before connecting to APE I would like to check, whether the user is allowed
to connect - his "u_member_id" should be written in the database table
"c_online". The function on server looks like this:

Ape.registerHookCmd("connect", function(params, cmd) {
    query = "SELECT * FROM c_online WHERE u_member_id = " + parseInt(
params.id) + " AND status = 0 ";
    sql.query(query , function(result, errorNo) {
            if (result.length==0) {
                return ["501", "BAD_PARAM"];
            }
    })
})

Obviously this approach does not work, because the return function is called
inside of a callback. Is there a simple way to do this kind of validation,
before I reinvent the wheel?

Regards,
Matija

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