awslabs / amazon-kinesis-video-streams-webrtc-sdk-js

JS SDK for interfacing with the Amazon Kinesis Video Streams Signaling Service.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-js/examples/index.html
Apache License 2.0
286 stars 141 forks source link

Master connection showing "Disconnected from signal channel" after 10 minutes? #218

Closed webdesigner97 closed 11 months ago

webdesigner97 commented 1 year ago

Hi, I am developing a video conferencing application using this SDK. But I the master connection is getting closed after 10 minutes. Same has been noted in the KVS WebRTC Test Page as well. I want the master to be able to wait for SDP offer from viewers for required period of time(atleast 1-2 hours). Is there a way to extend the connection duration from 10 minutes Below is the log: [2023-02-24T12:03:38.839Z] [INFO] [MASTER] Starting master connection [2023-02-24T12:03:39.836Z] [INFO] [MASTER] Connected to signaling service [2023-02-24T12:13:39.943Z] [INFO] [MASTER] Disconnected from signaling channel

niyatim23 commented 1 year ago

Hi @webdesigner97, can you please share the version of the master SDK that you are using? Have you been able to reproduce this with the sample application? If yes, can you please share the steps?

webdesigner97 commented 1 year ago

Thanks @niyatim23 for the reply. Please note the below details.

SDK version used to run from local machine : 2.0.1 and 2.0.2

The issue is also reproducible in the sample application from here .

Steps to reproduce the issue.

  1. Take the KVS WebRTC Test Page or run the sdk example code from the local machine
  2. Join the session/call as master.
  3. Wait for 10-15 minutes, and below line will be logged and master connection get disconnected from the signalling channel [2023-02-24T12:13:39.943Z] [INFO] [MASTER] Disconnected from signalling channel
  4. After the this error is logged when we try to connect as viewer from another browser tab, it will fails to establish the connection as master already exited from the channel.

Please let me know if you need any help on reproducing the issue.

mama-wk commented 1 year ago

I also noticed the same issue using the version 2.0.2. What makes it worse, when automatically reconnecting as master to the signaling channel, the SignalingClient.websocket says it is connected (readyState 1), but it does not receive any messages from the signaling channel. This means that no ice candidates or sdp offers arrive at the master, which breaks webrtc connectivity from the viewers. In the aws documentation it says that the latest master request overwrites the earlier ones, but either that is not the case, or something is broken in the websocket.

niyatim23 commented 1 year ago

@webdesigner97, for those 10-15 min, is any viewer connected to the master?

webdesigner97 commented 1 year ago

@niyatim23 Yes. with and without any viewer connected to the signalling channel, the issue will occur. I think the idle time for signalling channel connection from master is 10 minutes by default. So i need a way to increase the idle time.

sirknightj commented 1 year ago

Hi @webdesigner97,

Unfortunately, there is a hard limit of 10 minutes of idle time.

sirknightj commented 1 year ago

See also https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c/issues/524 and #83

sirknightj commented 1 year ago

There are a few options:

  1. Send a Websocket ping message. https://repost.aws/questions/QUV-egTr6_Skylz2_OHp8irw/websocket-api-server-side-ping-pong. Sending a ping message doesn't seem to be supported by browsers at the moment.
  2. Reopen the websocket whenever it closes due to inactivity.
    signalingClient.on('close', () => {
    signalingClient.open();
    });