diff --git a/app/Server/Connections/ConnectionManager.php b/app/Server/Connections/ConnectionManager.php index ed9b2bb..6ef7dc6 100644 --- a/app/Server/Connections/ConnectionManager.php +++ b/app/Server/Connections/ConnectionManager.php @@ -74,9 +74,20 @@ class ConnectionManager implements ConnectionManagerContract $this->logger->logSubdomain($storedConnection->authToken, $storedConnection->subdomain); + $this->performConnectionCallback($storedConnection); + return $storedConnection; } + protected function performConnectionCallback(ControlConnection $connection) + { + $connectionCallback = config('expose.admin.connection_callback'); + + if ($connectionCallback !== null && class_exists($connectionCallback)) { + app($connectionCallback)->handle($connection); + } + } + public function storeTcpConnection(int $port, ConnectionInterface $connection): ControlConnection { $clientId = (string) uniqid(); diff --git a/config/expose.php b/config/expose.php index 5045828..ae1637a 100644 --- a/config/expose.php +++ b/config/expose.php @@ -299,6 +299,17 @@ return [ */ 'subdomain_generator' => \App\Server\SubdomainGenerator\RandomSubdomainGenerator::class, + /* + |-------------------------------------------------------------------------- + | Connection Callback + |-------------------------------------------------------------------------- + | + | This is a callback method that will be called when a new connection is + | established. + | + */ + 'connection_callback' => null, + /* |-------------------------------------------------------------------------- | Users