From 8324cb3dd87736f90590229b8b86eaa63bc5d1c0 Mon Sep 17 00:00:00 2001 From: Andrii Lukashevych Date: Sat, 11 May 2024 18:37:30 +0300 Subject: [PATCH] fix websocket handlers call --- cli/ws.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/ws.php b/cli/ws.php index 4545e9bc..ef1a06b3 100644 --- a/cli/ws.php +++ b/cli/ws.php @@ -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; } @@ -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; } @@ -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); } @@ -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); }