SIP.js icon indicating copy to clipboard operation
SIP.js copied to clipboard

wss doesn't disconnect on laptop sleep (windows 11)

Open MarwaAbuEssa opened this issue 1 year ago • 1 comments

Describe the bug Hi ,

I'm using sipjs version 20 . I'm detecting network lost using both transport change and on disconnect event like the following :

userAgent.transport.onDisconnect = async (error?: Error) => {

and

this.userAgent.transport.stateChange.addListener(()=>

and everything is working fine from desktop when network disabled or network cable is unplugged . but with sleep option , no detection happens from sipjs side , although I'm using signalr and it report disconnect state !!!!.

the problem is when opening the laptop after sleep , the server send an option message and re-register the contact if still unavailable but at the same time it terminates the subscribe object and the presence notify is unavailable although the contact already registered.

my question is , how can I effectively detect any wss disconnect immediately in case of laptop sleep to clear old subscribes and contact and re-iniat it in a clean way upon connect .

Thanks, Marwa

Logs Please include a gist or attached file with full logs. If this is not included, the first response will likely be requesting them.

To Reproduce (if possible) Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Observed behavior A clear and concise description of what actually happened

Environment Information

  • Backend Server and version
  • Browser and version

Additional context Add any other context about the problem here.

MarwaAbuEssa avatar Aug 01 '22 18:08 MarwaAbuEssa

HI , If found out this issue is mainly related to windows 11 on laptop , any help please ?

MarwaAbuEssa avatar Aug 02 '22 15:08 MarwaAbuEssa

onDisconnect() will be called once the websocket figures out it is no longer connected, but it may not determine this immediately after opening the laptop. Please give it some time (minutes) and see if onDisconnect() is eventually called.

If onDisconnect() is never called, please provide a gist of full logs from the console going on for like 10 min and will perhaps consider a bug to investigate.

If onDisconnect() is eventually called, please provide a gist showing how long it takes and will perhaps open an enhancement request to see if we can come up with a way to get the websocket to detect the network issue faster.

Thanks

john-e-riordan avatar Sep 29 '22 20:09 john-e-riordan