Handling peak concurrent connections

How do we handle concurrent connections? We are using the Developer plans right now and it quickly exceed the PCC monthly quota (Flutter).

Do we need to call disconnect() every time after we leave the chat page?

If I run the app on 3 devices with same user but only 1 device is opening the chat page, does it count as 3 connections?

What is the best practice for lowering PCC?

Hello @thedates

Welcome to the Sendbird community!

As soon as connect() is called on the Chat SDK, the user is counted towards the MAU, regardless of whether or not you send a message. The act of connect() alone is what triggers the WebSocket connect and thus the inclusion of the user in the count.

You need to call disconnect() as soon as your purpose is served.

Please consider the below cases for PCC calculations:

â—Ź Case 1: If a user connects to the Sendbird server through three mobile devices, PCC calculates it as 3.

â—Ź Case 2: If a user executes a chat web application in three web browsers and makes conversations or reads the messages, PCC calculates it as 3 because each browser has its own process.

â—Ź Case 3: If a user executes a chat app on a mobile device and a computer at the same time and uses it on both sides, PCC calculates it as 2.

Please do refer to this FAQ for more details: What are Monthly Active Users and Peak Concurrent Connections and how are they calculated?

Let me know if this helps in clarifying a few things here.

@Chinmaya_Gupta thanks for the clarfication. What about a user using one laptop computer with one browser (chrome) and executes the “chat web application” in multiple tabs?

  • Same device
  • same browser
  • same “session” (ie. not incognito or other profile)
  • N > 1 Tabs
    Thanks

Typically tabs attribute to multiple websocket connections and thus increase the PCC. You can utilize concepts such as service works to share the connection amongst multiple tabs.

Thanks @Tyler, I did get an email response from your team stating:

Our latest JavaScript Chat SDK version 4 includes a feature that automatically disconnects the chat if a tab is left inactive for a certain amount of time. This can reduce the potential for multiple chat sessions open at once and improve user experience.

But I don’t see it mentioned anywhere in the docs… so which approach should we take? handle connections ourselves (react ui kit is buggy when re-connecting) or let the sdk handle it?
Thanks!

Hi @amit

If you’re speaking with the team already via a support case, I’ll let them respond so that we’re not stepping on each others toes.

Additionally, I’ll close this thread since you’ve got an active case open.

1 Like