prepublish(packet) {
		// Safely handle disconnected state
		if (!this.connected) {
			// For packets that are triggered intentionally by users, throw a retryable error.
			if ([P.PACKET_REQUEST, P.PACKET_EVENT, P.PACKET_PING].includes(packet.type)) {
				return this.broker.Promise.reject(new BrokerDisconnectedError());
			}

			// For internal packets like INFO and HEARTBEATS, skip sending and don't throw
			else {
				return this.broker.Promise.resolve();
			}
		}

		if (packet.type === P.PACKET_EVENT && packet.target == null && packet.payload.groups) {
			const groups = packet.payload.groups;
			// If the packet contains groups, we don't send the packet to
			// the targetted node, but we push them to the event group queues
			// and AMQP will load-balanced it.
			if (groups.length > 0) {
				groups.forEach(group => {
					// Create a copy of the packet because the `publishBalancedEvent` will modify the payload.
					const copy = _.cloneDeep(packet);
					// Change the groups to this group to avoid multi handling in consumers.
					copy.payload.groups = [group];
					this.publishBalancedEvent(copy, group);
				});
				return this.broker.Promise.resolve();
			}
			// If it's not contain, then it is a broadcasted event,
			// we sent it in the normal way (exchange)
		} else if (packet.type === P.PACKET_REQUEST && packet.target == null) {
			return this.publishBalancedRequest(packet);
		}

		// Normal packet publishing...
		return this.publish(packet);
	}
Prepublish a packet. Handle balancing.

@param {Packet} packet
@returns {Promise}
@memberof BaseTransporter