How to control ESP32 dev board with the Node-RED built-in broker Aedes?

The Aedes repo example has this:

const aedes = require('aedes')()
const server = require('net').createServer(aedes.handle)
const port = 1883

server.listen(port, function () {
  console.log('server started and listening on port ', port)
})

I had previously used this (partial) code for the ESP8266 dev board, some online broker, AWS and Node-RED:

#include <ESP8266WiFi.h>
#include <PubSubClient.h>

// [...]

void loop() {
  client.publish("voltage", msg);
}

Should the PubSubClient library be used? I mean, is it needed? Or is there a way to do it with just WiFiClientSecure or the WiFi library?

One Arduino client for MQTT is needed:
digikey.com/en/maker/blogs/2018/how-to-use-basic-mqtt-on-arduino
• PubSubClient
• MQTTClient
256dpi

Publisher ↔ Broker ↔ Subscriber

For example:

Node-RED ↔ Aedes ↔ PubSubClient

Detailed explanation: diyi0t.com/introduction-into-mqtt