fix(realtime): unsubscribe before resubscribing on permission change
Unsubcribe to remove subscriptions related to the old permissions.
This commit is contained in:
parent
5aa944ee82
commit
80769a0b65
1 changed files with 3 additions and 1 deletions
|
@ -380,8 +380,10 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
|
|||
$user = $database->getDocument('users', $userId);
|
||||
|
||||
$roles = Auth::getRoles($user);
|
||||
$channels = $realtime->connections[$connection]['channels'];
|
||||
|
||||
$realtime->subscribe($projectId, $connection, $roles, $realtime->connections[$connection]['channels']);
|
||||
$realtime->unsubscribe($connection);
|
||||
$realtime->subscribe($projectId, $connection, $roles, $channels);
|
||||
|
||||
$register->get('pools')->reclaim();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue