To clarify the issue, I added some more logging in the code. Here are the logs:2012-11-14 07:18:33 - libape-spidermonkey.c:2204 - JavaScript : custom log2012-11-14 07:18:33 - libape-spidermonkey.c:2204 - JavaScript : connect hook end2012-11-14 07:18:33 - src/users.c:180 - New user - (ip : 107.9.214.85)2012-11-14 07:18:36 - libape-spidermonkey.c:2204 - JavaScript : USER_NOT_LOGGED_INIt looks like it's finishing the hook and connecting the user before the http request callback finishes.Ape.registerHookCmd("connect", function(params, cmd) {Ape.log('custom log');if ( ! params || ! params.token) return ["001", "INVALID PARAMS"];checkLogin(params, cmd);Ape.log('connect hook end');});function checkLogin(params, cmd){var request = new Http('http://dev.itecode.com/bow/auction/index/checkLogin?SID=' + params.token+'&proId='+params.proId);request.getContent(function(result) { //call the PHP fileif ( ! result ) {//send error if cannot contact pagecmd.sendResponse('ERR', {'code': 1001, 'value': 'error_codes._1001'});Ape.log('USER_NOT_LOGGED_IN');return 0;}var result2=JSON.parse(result);if(result2.res == 'in auction'){Ape.log('USER_LOGGED_IN');return 1;}else {//send error if not logged incmd.sendResponse('ERR', {'code': 1001, 'value': 'error_codes._1001'});Ape.log('USER_NOT_LOGGED_IN');return 0;}});}--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to ape-p...@googlegroups.com
To unsubscribe from this group, send email to
ape-project...@googlegroups.com
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/
On the connect hook return -1
On checkLogin where USER_LOGGED_IN add
Ape.addUser(cmd.user)