Skip to content

refactor (graphql-server): Implements connection status control through graphql - #18272

Merged
gustavotrott merged 1 commit into
bigbluebutton:developfrom
gustavotrott:graphql-connectionStatus_Report
Jul 4, 2023
Merged

gustavotrott merged 1 commit into
bigbluebutton:developfrom
gustavotrott:graphql-connectionStatus_Report

Conversation

@gustavotrott

@gustavotrott gustavotrott commented Jul 4, 2023 •

Copy link
Copy Markdown
Contributor

Each client will need to update its connectionAliveAt prop each 10 seconds:

mutation UpdateConnectionAliveAt($userId: String, $connectionAliveAt: timestamp) {
        update_user_connectionStatus(
            where: {},
            _set: { connectionAliveAt: "now()" }
          ) {
            affected_rows
          }
      }

When the prop connectionAliveAt is updated, the server automatically set userClientResponseAt=null.
Once the client check that the prop userClientResponseAt is null. The client will update this prop:

mutation UpdateConnectionAliveAt($userId: String, $userClientResponseAt: timestamp) {
        update_user_connectionStatus(
            where: {userClientResponseAt: {_is_null: true}}
            _set: { userClientResponseAt: "now()" }
          ) {
            affected_rows
          }
      }

Using both fields the server will be able to calculate the client rtt rtt = userClientResponseAt - connectionAliveAt.
And then define the status of this client:

"newStatus" := CASE WHEN COALESCE("newRttInMs",0) > 2000 THEN 'critical'
	   					WHEN COALESCE("newRttInMs",0) > 1000 THEN 'danger'
	   					WHEN COALESCE("newRttInMs",0) > 500 THEN 'warning'
	   					ELSE 'normal' END;
  • Report query
subscription {
  user_connectionStatusReport {
    user {
      userId
      name
    }
    clientNotResponding
    lastUnstableStatus
    lastUnstableStatusAt
  }
}

@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2023

Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
5.5% 5.5% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@gustavotrott
gustavotrott merged commit 4ea7f74 into bigbluebutton:develop Jul 4, 2023
@gustavotrott
gustavotrott deleted the graphql-connectionStatus_Report branch September 13, 2023 20:02
@ramonlsouza ramonlsouza added this to the Release 3.0 milestone Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants