method(); if (is_string($method) && strtoupper($method) === 'OPTIONS') { $path = $request->path(); $path = is_string($path) ? trim($path, '/') : ''; $isApiOrAdmin = $path !== '' && (str_starts_with($path, 'api') || str_starts_with($path, 'admin')); if ($isApiOrAdmin) { $response = \app\common\middleware\AllowCrossDomain::optionsResponse($request); $connection->send($response); return; } } parent::onMessage($connection, $request); } }