More debugging for connects and disconnects

This commit is contained in:
Deon George 2021-08-24 16:32:19 +10:00
parent 03c6a5c426
commit edfb802805
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254

View File

@ -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'],