-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19742 from gustavotrott/graphql-connection-status…
…-refactor refactor: User Connection Status flow
- Loading branch information
Showing
18 changed files
with
195 additions
and
64 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...apps/src/main/scala/org/bigbluebutton/core/apps/users/UserConnectionAliveReqMsgHdlr.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.bigbluebutton.core.apps.users | ||
|
||
import org.bigbluebutton.common2.msgs._ | ||
import org.bigbluebutton.core.apps.RightsManagementTrait | ||
import org.bigbluebutton.core.db.UserConnectionStatusDAO | ||
import org.bigbluebutton.core.models.{ UserState, Users2x } | ||
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter } | ||
|
||
trait UserConnectionAliveReqMsgHdlr extends RightsManagementTrait { | ||
this: UsersApp => | ||
|
||
val liveMeeting: LiveMeeting | ||
val outGW: OutMsgRouter | ||
|
||
def handleUserConnectionAliveReqMsg(msg: UserConnectionAliveReqMsg): Unit = { | ||
log.info("handleUserConnectionAliveReqMsg: userId={}", msg.body.userId) | ||
|
||
for { | ||
user <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) | ||
} yield { | ||
UserConnectionStatusDAO.updateUserAlive(user.intId) | ||
} | ||
|
||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../src/main/scala/org/bigbluebutton/core/apps/users/UserConnectionUpdateRttReqMsgHdlr.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.bigbluebutton.core.apps.users | ||
|
||
import org.bigbluebutton.common2.msgs._ | ||
import org.bigbluebutton.core.apps.RightsManagementTrait | ||
import org.bigbluebutton.core.db.UserConnectionStatusDAO | ||
import org.bigbluebutton.core.models.{ UserState, Users2x } | ||
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter } | ||
|
||
trait UserConnectionUpdateRttReqMsgHdlr extends RightsManagementTrait { | ||
this: UsersApp => | ||
|
||
val liveMeeting: LiveMeeting | ||
val outGW: OutMsgRouter | ||
|
||
def handleUserConnectionUpdateRttReqMsg(msg: UserConnectionUpdateRttReqMsg): Unit = { | ||
log.info("handleUserConnectionUpdateRttReqMsg: networkRttInMs={} userId={}", msg.body.networkRttInMs, msg.body.userId) | ||
|
||
for { | ||
user <- Users2x.findWithIntId(liveMeeting.users2x, msg.body.userId) | ||
} yield { | ||
UserConnectionStatusDAO.updateUserRtt(user.intId, msg.body.networkRttInMs) | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { RedisMessage } from '../types'; | ||
|
||
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage { | ||
const eventName = `UserConnectionAliveReqMsg`; | ||
|
||
const routing = { | ||
meetingId: sessionVariables['x-hasura-meetingid'] as String, | ||
userId: sessionVariables['x-hasura-userid'] as String | ||
}; | ||
|
||
const header = { | ||
name: eventName, | ||
meetingId: routing.meetingId, | ||
userId: routing.userId | ||
}; | ||
|
||
const body = { | ||
userId: routing.userId, | ||
}; | ||
|
||
return { eventName, routing, header, body }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { RedisMessage } from '../types'; | ||
|
||
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage { | ||
const eventName = `UserConnectionUpdateRttReqMsg`; | ||
|
||
const routing = { | ||
meetingId: sessionVariables['x-hasura-meetingid'] as String, | ||
userId: sessionVariables['x-hasura-userid'] as String | ||
}; | ||
|
||
const header = { | ||
name: eventName, | ||
meetingId: routing.meetingId, | ||
userId: routing.userId | ||
}; | ||
|
||
const body = { | ||
userId: routing.userId, | ||
networkRttInMs: input.networkRttInMs | ||
}; | ||
|
||
return { eventName, routing, header, body }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 8 additions & 19 deletions
27
bigbluebutton-html5/imports/ui/components/connection-status/mutations.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,18 @@ | ||
import { gql } from '@apollo/client'; | ||
|
||
export const UPDATE_CONNECTION_ALIVE_AT = gql` | ||
mutation UpdateConnectionAliveAt($userId: String, $connectionAliveAt: timestamp) { | ||
update_user_connectionStatus( | ||
where: {}, | ||
_set: { connectionAliveAt: "now()" } | ||
) { | ||
affected_rows | ||
} | ||
mutation UpdateConnectionAliveAt { | ||
userSetConnectionAlive | ||
}`; | ||
|
||
export const UPDATE_USER_CLIENT_RESPONSE_AT = gql` | ||
mutation UpdateConnectionClientResponse($networkRttInMs: numeric) { | ||
update_user_connectionStatus( | ||
where: {userClientResponseAt: {_is_null: true}} | ||
_set: { | ||
userClientResponseAt: "now()", | ||
networkRttInMs: $networkRttInMs | ||
} | ||
) { | ||
affected_rows | ||
} | ||
export const UPDATE_USER_CLIENT_RTT = gql` | ||
mutation UpdateConnectionRtt($networkRttInMs: Float!) { | ||
userSetConnectionRtt( | ||
networkRttInMs: $networkRttInMs | ||
) | ||
}`; | ||
|
||
export default { | ||
UPDATE_CONNECTION_ALIVE_AT, | ||
UPDATE_USER_CLIENT_RESPONSE_AT, | ||
UPDATE_USER_CLIENT_RTT, | ||
}; |
Oops, something went wrong.