Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client-side onError() function is not fired as expected when the client can not connect the server. #963

Closed
freedom1989 opened this issue Mar 18, 2013 · 4 comments
Labels

Comments

@freedom1989
Copy link
Contributor

the bug happened when the transport is long-polling. to reproduce it, just set the request.url to a nonexistent one.
more details to see:
https://groups.google.com/forum/#!topic/atmosphere-framework/eV4rFSbpZH0

jfarcand added a commit that referenced this issue Mar 18, 2013
@jfarcand
Copy link
Member

Fixed. Try it and let me know what you think. I've improved the error message (_response.status).

@freedom1989
Copy link
Contributor Author

sorry, this fix does not work well.
If the server return a 404 error when subscribe, the expected behavior is:
onError() callback function will be fired.

but the test result is:
if the server return a 404 error, Atmosphere client will trigger onMessage() callback function and then onOpen().

when subscribing using long-polling, the server return:

HTTP/1.1 404 Not Found
Date: Wed, 20 Mar 2013 03:56:08 GMT
Vary: Accept-Encoding
Content-Type: text/html;charset=ISO-8859-1
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1384
Server: Jetty(7.6.8.v20121106)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /webmail-im/chatfdsa. Reason:
<pre>    Not Found</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                

</body>
</html>

which should not trigger neither the onOpen() method nor onMessage() method.

please check again.

@freedom1989
Copy link
Contributor Author

And what I want to do is to detect whether the client is connected the server or not.
I expected that if the client can not connect the server successfully, I can get a notification.

best regards,

@jfarcand
Copy link
Member

This is the expected behavior right now, e.g only error code larger than 500 will fire the onError. This behavior never changed, e.g atmosphere.js always allowed the onMessage() to be invoked. Please file another issue and I will see if I want to change the default behavior with 1.0.x . Thanks

jfarcand added a commit that referenced this issue Mar 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants