diff --git a/src/SocketIO.php b/src/SocketIO.php index 8e15936..d7489e5 100644 --- a/src/SocketIO.php +++ b/src/SocketIO.php @@ -133,12 +133,15 @@ public function onConnection($engine_socket) public function on() { - if(func_get_arg(0) === 'workerStart') - { - $this->worker->onWorkerStart = func_get_arg(1); - return; + $args = array_pad(func_get_args(), 2, null); + + if ($args[0] === 'workerStart') { + $this->worker->onWorkerStart = $args[1]; + } else if ($args[0] === 'workerStop') { + $this->worker->onWorkerStop = $args[1]; + } else if ($args[0] !== null) { + return call_user_func_array(array($this->sockets, 'on'), $args); } - return call_user_func_array(array($this->sockets, 'on'), func_get_args()); } public function in()