MCPcopy
hub / github.com/nestjs/nest / publishPacket

Method publishPacket

packages/microservices/client/client-mqtt.ts:232–250  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

230 this.subscriptionsCount.get(responseChannel) || 0;
231
232 const publishPacket = () => {
233 subscriptionsCount = this.subscriptionsCount.get(responseChannel) || 0;
234 this.subscriptionsCount.set(responseChannel, subscriptionsCount + 1);
235 this.routingMap.set(packet.id, callback);
236
237 const options =
238 isObject(packet?.data) && packet.data instanceof MqttRecord
239 ? packet.data.options
240 : undefined;
241 delete packet?.data?.options;
242 const serializedPacket: string | Buffer =
243 this.serializer.serialize(packet);
244
245 this.mqttClient!.publish(
246 this.getRequestPattern(pattern),
247 serializedPacket,
248 this.mergePacketOptions(options),
249 );
250 };
251
252 if (subscriptionsCount <= 0) {
253 this.mqttClient!.subscribe(

Callers

nothing calls this directly

Calls 7

getRequestPatternMethod · 0.95
mergePacketOptionsMethod · 0.95
isObjectFunction · 0.90
getMethod · 0.65
setMethod · 0.65
serializeMethod · 0.65
publishMethod · 0.45

Tested by

no test coverage detected