async send ({ event, to, payload } = {}) {
    if (this.isConnected === false) {
      throw new Error('Tried to send message but the bridge is not connected. Please connect it first.')
    }

    if (!event) {
      throw new Error('Tried to send message with no "event" prop specified')
    }

    if (!to) {
      throw new Error('Tried to send message with no "to" prop specified')
    }

    if (this.portList.includes(to) === false) {
      throw new Error(
        this.#type === 'background'
          ? `Tried to send message to "${ to }" but there is no such port registered`
          : `Tried to send message to "${ to }" but the port to background is not available to send through`
      )
    }

    const id = getRandomId(1_000_000)

    await this.#sendMessage({
      id,
      to,
      payload,
      messageType: 'event-send',
      messageProps: { event }
    })

    if (this.portList.includes(to) === false) {
      throw new Error(`Connection to "${ to }" was closed while waiting for a response`)
    }

    return new Promise((resolve, reject) => {
      this.messageMap[ id ] = {
        portName: to,
        resolve: responsePayload => {
          delete this.messageMap[ id ]
          resolve(responsePayload)
        },
        reject: err => {
          delete this.messageMap[ id ]
          reject(err)
        }
      }
    })
  }
@param {{ event: string, to: string, payload: any } | undefined} param
@returns {Promise<any>} response payload