AgoraIO-Community / AgoraWebSDK-NG

The Next Generation of Agora Web SDK
https://agoraio-community.github.io/AgoraWebSDK-NG/
161 stars 75 forks source link

AgoraRTCError INVALID_OPERATION: [client-b0efd] Client already in connecting/connected state #106

Closed FarazPatankar closed 3 years ago

FarazPatankar commented 4 years ago

Describe the bug

We've had this issue pop up on Sentry a few times now. Here's what we see on our end:

{
code: INVALID_OPERATION, 
data: [undefined], 
message: AgoraRTCError INVALID_OPERATION: [client-b0efd] Client already in connecting/connected state, 
name: AgoraRTCException
}

Here's the code we've written for publishing the streams:

const tracks = await createLocalTracks()

await client.join(appId, String(channel), token, uid)
await client.enableDualStream()
await client.setStreamFallbackOption(remoteUserVideoUid, 2)
await client.publish(tracks)

Could someone shed some light on why this happens and how we can avoid it? Do we simply check if the client is already trying to connect and not call join in that case?

Any help would be greatly appreciated!

FarazPatankar commented 3 years ago

@HAHAHA44 @disoul Could you please respond to this? It's showing up very often for us.

HAHAHA44 commented 3 years ago

You call the join multiple times. It should be called once before leave.