Skip to content

Timeouts cleared within websocket events cause zone to hang #149

@matthewp

Description

@matthewp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions