@@ 186,6 186,24 @@ class AdminApiModule implements ServiceModuleInterface
}
}
);
+
+ $service->post(
+ '/v1/delete_connection',
+ function (Request $request, UserInfo $userInfo): Response {
+ try {
+ $userId = $request->requirePostParameter('user_id', fn(string $s) => Validator::userId($s));
+ if (null === $this->storage->userInfo($userId)) {
+ throw new HttpException('user does not exist', 400);
+ }
+ $connectionId = $request->requirePostParameter('connection_id', fn(string $s) => Validator::connectionId($s));
+ $this->connectionManager->disconnectByConnectionId($userId, $connectionId);
+
+ return new Response(null, [], 204);
+ } catch (ConnectionManagerException $e) {
+ throw new HttpException(sprintf('/v1/delete_connection failed: %s', $e->getMessage()), 500);
+ }
+ }
+ );
}
/**