Skip to content

Commit

Permalink
Remove ws callback
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0Vu committed Jan 1, 2024
1 parent db48d4d commit 8680f14
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 30 deletions.
22 changes: 0 additions & 22 deletions src/Providers/WsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ class WsClient {

public $url;

public $on_message_callback;
public $on_error_callback;
public $on_close_callback;
public $on_connected_callback;

public $error;
public $connectionEstablished;
public $timeout = 1;
Expand Down Expand Up @@ -78,10 +73,6 @@ public function reject($result) {

public function __construct(
$url,
callable $on_message_callback,
callable $on_error_callback,
callable $on_close_callback,
callable $on_connected_callback,
$timeout = 1,
$keepAlive = 30,
$maxPingPongMisses = 2.0,
Expand All @@ -90,11 +81,6 @@ public function __construct(
) {

$this->url = $url;

$this->on_message_callback = $on_message_callback;
$this->on_error_callback = $on_error_callback;
$this->on_close_callback = $on_close_callback;
$this->on_connected_callback = $on_connected_callback;

$this->timeout = $timeout;
$this->keepAlive = $keepAlive;
Expand Down Expand Up @@ -132,8 +118,6 @@ function($connection) {
$this->connectionEstablished = $this->milliseconds();
$this->deferredConnected->resolve($this->url);
$this->set_ping_interval();
$on_connected_callback = $this->on_connected_callback;
$on_connected_callback($this);
},
function(\Exception $error) {
// the ordering of these exceptions is important
Expand Down Expand Up @@ -188,14 +172,10 @@ public function on_pong($message) {

public function on_error($error) {
$this->error = $error;
$on_error_callback = $this->on_error_callback;
$on_error_callback($this, $error);
$this->reset($error);
}

public function on_close($message) {
$on_close_callback = $this->on_close_callback;
$on_close_callback($this, $message);
if (!$this->error) {
// todo: exception types for server-side disconnects
$this->reset(new RuntimeException($message));
Expand All @@ -211,8 +191,6 @@ public function on_message(Message $message) {
}

try {
// $on_message_callback = $this->on_message_callback;
// $on_message_callback($this, $message);
$this->resolve($message);
} catch (Exception $error) {
$this->reject($error);
Expand Down
8 changes: 0 additions & 8 deletions src/Providers/WsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ public function __construct($host, $timeout = 1)
parent::__construct($host, $timeout);
$this->client = new WsClient(
$host,
function ($obj, $message) {
},
function ($obj, $error) {
},
function ($obj, $close) {
},
function ($obj, $connected) {
},
$timeout
);
$this->client->set_ws_connector();
Expand Down

0 comments on commit 8680f14

Please sign in to comment.