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

Method getPublisher

packages/microservices/server/server-mqtt.ts:169–193  ·  view source on GitHub ↗
(
    client: MqttClient,
    context: MqttContext,
    id: string,
  )

Source from the content-addressed store, hash-verified

167 }
168
169 public getPublisher(
170 client: MqttClient,
171 context: MqttContext,
172 id: string,
173 ): any {
174 return (response: any) => {
175 Object.assign(response, { id });
176
177 const options =
178 isObject(response?.data) && response.data instanceof MqttRecord
179 ? (response.data as MqttRecord)?.options
180 : {};
181 delete response?.data?.options;
182
183 const outgoingResponse: string | Buffer =
184 this.serializer.serialize(response);
185
186 this.onProcessingEndHook?.(this.transportId, context);
187 return client.publish(
188 this.getReplyPattern(context.getTopic()),
189 outgoingResponse,
190 options,
191 );
192 };
193 }
194
195 public parseMessage(content: any): ReadPacket & PacketId {
196 try {

Callers 5

handleMessageMethod · 0.95

Calls 6

getReplyPatternMethod · 0.95
isObjectFunction · 0.90
assignMethod · 0.80
serializeMethod · 0.65
publishMethod · 0.45
getTopicMethod · 0.45

Tested by

no test coverage detected