🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Client WebSocket disconnects when browser is minimized or not in focus - Chrome

[Deleted User]
[Deleted User] Posts: 25
edited April 2021 in Tips and Tricks #1

Here's a tip for anyone using websockets and chrome to establish a connection to their PubSub+ broker.

The issue:

You might be experiencing websocket disconnects after 5-6 minutes of your chrome browser being minimized or out in focus. The session disconnects with the message "Connection closed: 1001 Going Away (The endpoint is going away due to a server failure or client navigation), clean closure: true"

The cause:

In July 2020, a Chrome feature intended to save battery life was introduced. "Intensive throttling of Javascript timer wake ups" throttles at a 1-minute (60 second) interval. See here for more info: https://www.chromestatus.com/feature/4718288976216064

This conflicts with the default web-transport inactive-timeout setting that is set to 30s on client profiles.

When the Javascript timer is throttled at a 1-minute interval, the web client will be unable to send keepalive messages to your broker within the default 30s inactivity timeout. To avoid the issue, either disable the feature "Intensive throttling of Javascript timer wake ups" in Chrome or change the inactivity-timeout to a value more than 60s.

The fix:

To avoid the issue, either
1. disable the feature "Intensive throttling of Javascript timer wake ups" in Chrome or,
2. change the web-transport inactive-timeout in the client profile to more than 60 seconds.

To disable the Chrome feature, key in "chrome://flags" in Chrome URL field, search for "Throttle Javascript timer" and disable the feature.

Comments

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 644 admin

    I actually didn't know this! It explains why my JavaScript bus demo disconnects a lot more frequently now, vs. a couple years ago if I'm away from that Chrome tab. I've updated theweb-transport inactive-timeout in my client-profile to 75 seconds and it totally fixed the issue! 👍