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

Timeouts cleared within websocket events cause zone to hang #149

Open
matthewp opened this Issue Nov 6, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@matthewp
Copy link
Contributor

matthewp commented Nov 6, 2017

Consider this code:

var ws = new WebSocket(url);

var timeout = setTimeout(function(){
  // Testing if it worked.
}, 30000);

ws.onmessage = function(){
  clearTimeout(timeout);
};

This scenario happens with some socket.io logout libraries. The web socket message doesn't happen within a Zone, so the clearTimeout call doesn't cause the setTimeout's task to complete.

The fix is to make sure that websocket messages are wrapped within a Zone.

@matthewp matthewp added the bug label Nov 6, 2017

@matthewp

This comment has been minimized.

Copy link
Contributor

matthewp commented Nov 6, 2017

#108 is related.

James0x57 added a commit that referenced this issue Nov 6, 2017

@James0x57 James0x57 referenced a pull request that will close this issue Nov 6, 2017

Open

WebSocket onmessage use zones to capture async behavior #150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment