Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call reconnects after leaving #1618

Open
1 of 3 tasks
VisasIespejas opened this issue Dec 11, 2024 · 0 comments
Open
1 of 3 tasks

Call reconnects after leaving #1618

VisasIespejas opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@VisasIespejas
Copy link

Which package/packages do you use?

  • @stream-io/video-react-sdk
  • @stream-io/video-react-native-sdk
  • @stream-io/video-client

Describe the bug
Call will sometimes reconnect after leaving. For me this happens in React development mode when double render causes useEffect to join and leave a call in quick succession (see snippet below for useEffect logic).

To Reproduce

  1. Use this code snippet in React development mode:
let promises = Promise.resolve();
function serially(promise) {
  promises = promises.finally(() => promise());
}

export default function App() {
  const [state, setState] = useState<any>(null);
  useEffect(() => {
    const callCounter = ++counter;
    const client = StreamVideoClient.getOrCreateInstance({
      apiKey,
      user,
      token,
    });
    const call = client.call("default", callId);
    call.state.callingState$.subscribe((state) =>
      console.log(`[${callCounter}] call state ${state}`),
    );
    let isActive = true;
    serially(() =>
      call.join().then(() => isActive && setState({ client, call })),
    );
    return () => {
      isActive = false;
      setState(null);
      serially(() => call.leave());
    };
  }, []);
  return (
    state && (
      <StreamVideo client={state.client}>
        <StreamTheme>
          <StreamCall call={state.call}>
            <SpeakerLayout />
            <CallControls />
          </StreamCall>
        </StreamTheme>
      </StreamVideo>
    )
  );
}
  1. Open the example in browser and allow permissions (you may need to reload multiple times for this to happen)
  2. You may see that the user has joined the call twice. The console logs will show something like this:
    image
    Here you can see that call [1] has reconnected after leaving.

Expected behavior
Leaving the call happens cleanly and it does not reconnect.

Screenshots
Here you can see that the user has connected twice, because call reconnected after leaving:
image

Version

  • SDK version 1.8.1

React / JS client

  • Browser: Edge 131.0.2903.86
    (I experienced the issue in all browsers, but seems to happen more consistently in edge for me)

Node JS client

  • Node version: v20.16.0

Additional context
Add any other context about the problem here.

@VisasIespejas VisasIespejas added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant