unmk2 / jaxl

Automatically exported from code.google.com/p/jaxl
GNU General Public License v3.0
0 stars 0 forks source link

No way to get errors from BOSH server #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If using BOSH and there is an error, like for example the remote XMPP server is 
down, there is no way to get the error.
We get this from the BOSH server: <body 
xmlns='http://jabber.org/protocol/httpbind' type='terminate' 
condition='remote-connection-failed'/>
But JAXL0124::unwrapBody() at xep/jaxl.0124.php:224 is called before the user 
event handlers and eliminates the error without notifying it.

Original issue reported on code.google.com by iba...@gmail.com on 30 May 2012 at 7:56

GoogleCodeExporter commented 9 years ago
Ok, now I found that I can register the jaxl_pre_handler before the requires 
for JAXL0206 and that way detect the errors.
With regular expressions I get the type and condition attributes of the <body> 
tag and if type is 'terminate' and condition contains something then I report 
the error for the user.
But anyway I think this issue should be kept open until JAXL implements a 
handler to handle the terminate error type from the BOSH server passing the 
condition attribute to the handler, so users of JAXL don't need to fiddle with 
regular expressions.
In case it helps someone, this is my jaxl_pre_handler:
    function JAXLPreHandler ($payload, $jaxl)
    {
        //echo "DEBUG: " . __METHOD__ . ": "; var_dump ($payload);
        preg_match ('/<body.*[[:blank:]]*type[[:blank:]]*=[[:blank:]]*[\'"]([^\'"]*)[\'"]/',
            $payload, $Matches);
        $Type = strtolower(trim(@$Matches[1])); unset($Matches);
        if ($Type == 'terminate') {
            preg_match ('/<body.*[[:blank:]]*condition[[:blank:]]*=[[:blank:]]*[\'"]([^\'"]*)[\'"]/',
                $payload, $Matches);
            $Condition = trim(@$Matches[1]); unset($Matches);
            if ($Condition != '') throw new Exception("Connection error: $payload.");
        }
    }

Hope this helps, thanks!

Original comment by iba...@gmail.com on 30 May 2012 at 10:56

GoogleCodeExporter commented 9 years ago
Grr, forgot to add "return $payload;" to the end of that function, sorry! :-)

Original comment by iba...@gmail.com on 30 May 2012 at 11:08

GoogleCodeExporter commented 9 years ago
Hello Friends,

I am no longer accepting issues/bugs on google code issue list.

Have any Question? Want to discuss? Need Help? Use Google Group/Forum.
https://groups.google.com/forum/#!forum/jaxl

Found something missing or a bug in the source code? Kindly report an issue.
https://github.com/abhinavsingh/JAXL/issues

Sorry for any inconvenience caused.

--
Abhinav

Original comment by mailsfor...@gmail.com on 12 Sep 2012 at 9:48