public function on(string $event, $callback)
    {
        if (! is_string($callback) && ! is_callable($callback)) {
            throw new InvalidArgumentException(
                'Invalid websocket callback. Must be a string or callable.'
            );
        }

        $this->callbacks[$event] = $callback;

        return $this;
    }
public function on(string $event, $callback)
    {
        if (! is_string($callback) && ! is_callable($callback)) {
            throw new InvalidArgumentException(
                'Invalid websocket callback. Must be a string or callable.'
            );
        }

        $this->callbacks[$event] = $callback;

        return $this;
    }
public function on ( string $ event , $ callback ) { if ( ! is_string ( $ callback ) && ! is_callable ( $ callback ) ) { throw new InvalidArgumentException ( 'Invalid websocket callback. Must be a string or callable.' ) ; } $ this -> callbacks [ $ event ] = $ callback ; return $ this ; }
Register an event name with a closure binding.

@param string
@param callback

@return $this
Register an event name with a closure binding .