Skip to content

Commit

Permalink
fix websocket handlers call
Browse files Browse the repository at this point in the history
  • Loading branch information
LukashevychAndrii authored and ikkez committed Dec 28, 2024
1 parent 391d1cb commit 5361455
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cli/ws.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ function send($op,$data='') {
if (is_bool($server->write($this->socket,$buf)))
return FALSE;
if (!in_array($op,[WS::Pong,WS::Close]) &&
isset($this->server->events['send']) &&
is_callable($func=$this->server->events['send']))
isset($this->server->events()['send']) &&
is_callable($func=$this->server->events()['send']))
$func($this,$op,$data);
return $data;
}
Expand Down Expand Up @@ -446,8 +446,8 @@ function fetch() {
case WS::Text:
$data=trim($data);
case WS::Binary:
if (isset($this->server->events['receive']) &&
is_callable($func=$this->server->events['receive']))
if (isset($this->server->events()['receive']) &&
is_callable($func=$this->server->events()['receive']))
$func($this,$op,$data);
break;
}
Expand All @@ -459,8 +459,8 @@ function fetch() {
* Destroy object
**/
function __destruct() {
if (isset($this->server->events['disconnect']) &&
is_callable($func=$this->server->events['disconnect']))
if (isset($this->server->events()['disconnect']) &&
is_callable($func=$this->server->events()['disconnect']))
$func($this);
}

Expand All @@ -479,8 +479,8 @@ function __construct($server,$socket,$verb,$uri,array $hdrs) {
$this->uri=$uri;
$this->headers=$hdrs;

if (isset($server->events['connect']) &&
is_callable($func=$server->events['connect']))
if (isset($server->events()['connect']) &&
is_callable($func=$server->events()['connect']))
$func($this);
}

Expand Down

0 comments on commit 5361455

Please sign in to comment.