Hi,

It's an async request.
You must use Ape.addUser(cmd.user) in your sql callback en return -2 in the hook function.

Check the http identification in the exemples directory.

Anthony Catel

Le 18 juil. 2010 à 14:14, hlop <[email protected]> a écrit :

Please HELP
my serverside script:

Ape.registerHookCmd("connect", function(params, cmd) {
 cmd.user.setProperty('uid', params.uid);

 sql.query('SELECT * FROM user WHERE id="1" LIMIT 1;', function(res,
errorNo) {
   if (errorNo) { username = "mysql error"; }
   else { username = (res[0].name.length>=3 ? res[0].name :
(res[0].id>0?"USER "+res[0].id:"Guest") ); }
   cmd.user.setProperty('name', username);
 }.bind(this));

 return 1;
});

The sql.query works only after refreshing the site with F5, in don't
know why.
the setProperty('uid'... works at the first call and the
setProperty('name'... only after refresh of the site

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

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