Iris icon indicating copy to clipboard operation
Iris copied to clipboard

Re-establishing WS after extended background inactivity

Open BrainStone opened this issue 4 years ago • 7 comments

Describe the bug When shutting down the computer over night (while leaving the tabs open in the browser (I'm kinda a tab messy and keep everything open)) and opening the browser the next day and accessing Iris I get a red error message in the bottom left that says "Mopidy: Call to an invalid object. Check you are calling a valid Mopidy object."

It is fixed by reloading without the cache (Ctrl + F5 on Firefox).

To Reproduce Steps to reproduce the behavior:

  1. Shut your computer down without closing the Iris tab.
  2. Start the browser the next day so that it restores the tabs
  3. Try to do anything in Iris. It shows that messages pretty much every time you try to do anything.

Expected behavior I'd expect it to not show that warning and continue working

Screenshots grafik

Environment details:

  • OS: Windows 10
  • Browser: Firefox and Chrome
  • Iris version: 3.45.1

Additional context Nothing major, just annoying.

BrainStone avatar Mar 03 '20 14:03 BrainStone

This is an error that results when the Mopidy websocket object is missing, damaged or non-responsive. This can happen for a multitude of reasons - most of which are beyond the scope of Iris.

When you leave a tab in the background, many browsers limit their processes (usually to limit battery usage). Or your computer puts the network adapter into sleep mode. Or your computer has gone in to low power mode.

Iris will attempt to reconnect to both websocket endpoints when a disconnection occurs. However what I think you're describing is where the websocket hasn't been disconnected, just throttled. My theory is that this throttled connection now has a long queue of pending messages which bogs down the connection somewhere, causing the issue.

Iris will re-fetch the latest player state and queue on bringing the tab back to the foreground, but beyond that I don't know of a fix to this issue.

jaedb avatar Mar 08 '20 20:03 jaedb

This happens for me when my computer was off and the tab has been restored.

BrainStone avatar Mar 08 '20 20:03 BrainStone

Exactly - the browser is manipulating a long-running TCP (websocket) connection by restoring it. It needs to connect.

My advice is to pin your Iris tab and refresh it when necessary.

jaedb avatar Mar 08 '20 20:03 jaedb

I mean wouldn't it be possible to try to detect that and reopen the socket?

BrainStone avatar Mar 08 '20 20:03 BrainStone

@BrainStone you are most welcome to have a go at developing that and submitting a pull request.

jaedb avatar Mar 08 '20 21:03 jaedb

I would if I had a clue about WebSockets.

BrainStone avatar Mar 08 '20 21:03 BrainStone

@BrainStone do you still have that issue? I often put my PC into hibernation mode over night with Iris open and I've never seen this notification :)

Chaphasilor avatar Oct 24 '21 21:10 Chaphasilor