addEdge(edge, options, callback) {
    if (typeof options === 'function') {
      callback = /** @type {AddEdgeCallback} */ (options);
      options = {};
    }
    const promise = this.ensureNode(edge.from.node, 'outbound')
      .then((from) => {
        const socket = internalSocket.createSocket(edge.metadata, {
          debug: this.debug,
          async: this.asyncDelivery,
        });
        return this.ensureNode(edge.to.node, 'inbound')
          .then((to) => {
            // Subscribe to events from the socket
            this.subscribeSocket(socket, from);

            return connectPort(socket, to, edge.to.port, edge.to.index, true);
          })
          .then(() => connectPort(socket, from, edge.from.port, edge.from.index, false))
          .then(() => {
            this.connections.push(socket);
            return socket;
          });
      });
    if (callback) {
      deprecated('Providing a callback to Network.addEdge is deprecated, use Promises');
      promise.then((socket) => {
        callback(null, socket);
      }, callback);
    }
    return promise;
  }
@param {import("fbp-graph/lib/Types").GraphEdge} edge
@param {Object} options
@param {AddEdgeCallback} [callback]
@returns {Promise<internalSocket.InternalSocket>}