Skip to content

Conversation

@hyperlink
Copy link

Note: the engine.io.js file is the generated output of make engine.io.js, and should not be manually modified.

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

An immediate setTimeout is used to unblock the WebSocket write. Unfortunately, this setTimeout can be throttled by browsers when the tab is backgrounded. This can lead to missed pong responses to server pings which leads to disconnects.

New behaviour

Move the unblocking code block into a then handler of an immediate Promise.resolve. The then handler does not suffer from Timer throttling and will ensure the code gets executed asynchronously without unintended delay.

Other information (e.g. related issues)

#649 (comment)

darrachequesne pushed a commit that referenced this pull request Jun 22, 2021
An immediate setTimeout was used to unblock the WebSocket write.
Unfortunately, this setTimeout can be throttled by browsers when the
tab is backgrounded.

This can lead to missed pong responses to server pings, which
eventually leads to disconnection.

Related: #649
@hyperlink
Copy link
Author

👍🏼

@hyperlink hyperlink closed this Jun 23, 2021
@hyperlink hyperlink deleted the fix-setTimeout-throttle branch June 23, 2021 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant