Dear APE team,
   Im getting the below message while trying to debug my problem. Is
there any file I'm missing  out or any function that Im not using
properly
/var/ape/commands/inlinepush.js:75:ReferenceError: $defined is not
defined
/var/ape/commands/inlinepush.js:4:TypeError: cmd.sendResponse is not a
function
Inline Push problem


Thanks and Regards,
Sudeep Sunthankar

On Jun 7, 12:42 pm, Sudeep Sunthankar <[email protected]> wrote:
> Dear APE Team,
>
> Im using the inline push feature with CONNECT hook command, but it gives me
> below error sometimes:
>
> 1) cmd.sendResponse  is not a function.
> Also sometimes when I'm using the mkChan function to create a channel I do
> not get the CHANNEL raw back on the client side.
> As mentioned earlier  I have only kept the foll 3 files below files at my
> server side
>
> include("framework/Http.js");
> include("commands/inlinepush.js");
>
> Below is the function:
>
> Ape.registerHookCmd("CONNECT", function(params, cmd) {
>     var ClientErrorResponse = "Incorrect User Name or Password";
>     if (!((params.username || params.username == 'null') && (params.pwd ||
> params.pwd == 'null'))){
>         cmd.sendResponse("authfail", {"fail":"true", "response":{
> "errcode":"1", "reason" : ClientErrorResponse}});
>         return 0;
>     }
>     var authurl = "http://localhost/auth.php";;
>     var request = new Http(authurl);
>     var cookie = "passwd="+params.pwd;
>     request.setHeader('COOKIE', cookie);
>     request.getContent(function(result) {
>     var ret = {};
>         try {
>             ret = JSON.parse(result);
>         } catch(e){
>             Ape.log("Caught error in JSON Object Parsing, Data returned is
> not in Proper format")
>         };
>         if(ret.details.respcode == 0){
>             Ape.log('Authentication Failure');
>             cmd.sendResponse("authfail", {"fail":"true", "response":{
> "errcode":"2", "reason":"Authentication Failure. }});
>         }
>         if(ret.details.respcode == 1){
>             var userkeyname = 'servercookie';
>             var secretname =
> Ape.sha1.str(decodeURIComponent(params.username));r
>             var secretkey = Ape.sha1.str(userkeyname +
> decodeURIComponent(params.pwd));
>             cmd.user.userkeyname = secretkey;
>             var tmpchan = decodeURIComponent(params.pwd);
>             var chan= Ape.sha1.str(tmpchan);
>             var chanobj = Ape.getChannelByName(chan);
>             if (!$defined(chanobj)) {
>                     chanobj = Ape.mkChan(chan);
>             }else{
>                     Ape.log('Channel ' + chan + ' is already present ');
>             }
>
>             cmd.sendResponse("authsuccess", {"fail":"false", "response":{
> "errcode":"0", "reason":"Authentication Success", "channel" : chan}});
>             var url = "http://localhost/auth_fail.php";;
>             var request = new Http(url);
>             request.set('method', 'POST');
>             request.writeData('user_wrong', params.username);
>             request.writeData('pwd_wrong', params.pwd);
>             request.writeData('action', 'login');
>             request.getContent(function(result) {
>                 Ape.log('Response returned is ' + result);
>                 var ret = {};
>                 try {
>                     ret = JSON.parse(result);
>                 } catch(e){
>                     Ape.log("Caught error in JSON Object Parsing, Data
> returned is not in Proper format")
>                 };
>             });
>             return 1;
>         }
>     });
>
> });
>
> Can you please tell me if there is anything wrong, because I am unable to
> fix it  and if such an issue arises when my application is live, there
> should be some way to debug it .
>
> Also let me tell you that sometimes the function works properly
>
> --
> Regards,
> Sudeep Sunthankar
>
> On Fri, Jun 4, 2010 at 6:08 PM, Sudeep S <[email protected]> wrote:
> > Dear APE Team,
> >  I want to use only the controller and HTTP hit functionality on the
> > JSSS. So in the main_ape.js fileI had commented the below lines
> > include("framework/mootools.js");
> > include("framework/http_auth.js");
> > include("commands/proxy.js");
> > include("utils/checkTool.js");
> > include("examples/move.js");
> > include("examples/ircserver.js");
> > include("examples/nickname.js");
> > --------------------------
> > The below files were letf uncommented
> >    include("framework/userslist.js");
> >    include("framework/Http.js");
> >    include("commands/inlinepush.js");
> >    include("utils/utils.js");
>
> > But on CONNECT HookCmd when Im sending a custom raw after some
> > validation, I'm not able to receive that raw on the client side and Im
> > getting an error which says TypeError: cmd.sendResponse is not a
> > function.
>
> > Can you please share some pointers to this.
>
> > Regards,
> > Sudeep Sunthankar
>
> > --
> > 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]<ape-project%[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