Changeset View
Changeset View
Standalone View
Standalone View
src/app/OpenVidu/Room.php
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | public function getSessionConnections(): array | ||||
} | } | ||||
return Connection::where('session_id', $this->session_id) | return Connection::where('session_id', $this->session_id) | ||||
// Ignore screen sharing connection for now | // Ignore screen sharing connection for now | ||||
->whereRaw("(role & " . self::ROLE_SCREEN . ") = 0") | ->whereRaw("(role & " . self::ROLE_SCREEN . ") = 0") | ||||
->get() | ->get() | ||||
->keyBy('id') | ->keyBy('id') | ||||
->map(function ($item) { | ->map(function ($item) { | ||||
// For now we need only 'role' property, it might change in the future. | // Warning: Make sure to not return all metadata here as it might contain sensitive data. | ||||
// Make sure to not return all metadata here as it might contain sensitive data. | return [ | ||||
return ['role' => $item->role]; | 'role' => $item->role, | ||||
'hand' => $item->metadata['hand'] ?? 0, | |||||
]; | |||||
}) | |||||
// Sort by order in the queue, so UI can re-build the existing queue in order | |||||
->sort(function ($a, $b) { | |||||
return $a['hand'] <=> $b['hand']; | |||||
}) | }) | ||||
->all(); | ->all(); | ||||
} | } | ||||
/** | /** | ||||
* Create a OpenVidu session (connection) token | * Create a OpenVidu session (connection) token | ||||
* | * | ||||
* @param int $role User role (see self::ROLE_* constants) | * @param int $role User role (see self::ROLE_* constants) | ||||
▲ Show 20 Lines • Show All 209 Lines • Show Last 20 Lines |