public function __construct(SocketListenerInterface $socket, NetworkComponentInterface $component = null) { $this->socket = $socket; $this->component = $component === null ? new NullServer() : $component; $socket->on('connect', [$this, 'handleConnect']); }