From edfb802805552c01a8a10766c08f2f4598601cd2 Mon Sep 17 00:00:00 2001 From: Deon George Date: Tue, 24 Aug 2021 16:32:19 +1000 Subject: [PATCH] More debugging for connects and disconnects --- src/Client/SocketMode.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Client/SocketMode.php b/src/Client/SocketMode.php index 5282b0b..dacb797 100644 --- a/src/Client/SocketMode.php +++ b/src/Client/SocketMode.php @@ -7,6 +7,7 @@ use Devristo\Phpws\Messaging\WebSocketMessageInterface; use Evenement\EventEmitterTrait; use GuzzleHttp\ClientInterface; use Illuminate\Http\Client\ConnectionException; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Log; use React\EventLoop\LoopInterface; use React\Promise\Deferred; @@ -103,10 +104,15 @@ class SocketMode extends API // then wait for the connection to be ready. ->then(function () use ($deferred) { - $this->once('hello', function () use ($deferred) { + $this->once('hello', function ($data) use ($deferred) { + Log::debug(sprintf('%s:- hello [#%d]...',self::LOGKEY,Arr::get($data->getData(),'num_connections')),['m'=>__METHOD__,'d'=>$data]); $deferred->resolve(); }); + $this->once('disconnect', function ($data) use ($deferred) { + Log::debug(sprintf('%s:- disconnect ...',self::LOGKEY),['m'=>__METHOD__,'d'=>$data]); + }); + $this->once('error', function ($data) use ($deferred) { $deferred->reject(new ConnectionException( 'Could not connect to WebSocket: '.$data['error']['msg'],