MCPcopy Create free account
hub / github.com/triggerdotdev/trigger.dev / send

Method send

packages/core/src/v3/zodIpc.ts:263–287  ·  view source on GitHub ↗
(
    type: K,
    payload: z.input<GetSocketMessageSchema<TEmitCatalog, K>>
  )

Source from the content-addressed store, hash-verified

261 }
262
263 async send<K extends GetSocketMessagesWithoutCallback<TEmitCatalog>>(
264 type: K,
265 payload: z.input<GetSocketMessageSchema<TEmitCatalog, K>>
266 ): Promise<void> {
267 const schema = this.opts.emitSchema[type]["message"];
268
269 if (!schema) {
270 throw new Error(`Unknown message type: ${type as string}`);
271 }
272
273 const parsedPayload = schema.safeParse(payload);
274
275 if (!parsedPayload.success) {
276 throw new ZodSchemaParsedError(parsedPayload.error, payload);
277 }
278
279 await this.#sendPacket({
280 type: "EVENT",
281 message: {
282 type,
283 payload,
284 version: "v1",
285 },
286 });
287 }
288
289 public async sendWithAck<K extends GetSocketMessagesWithCallback<TEmitCatalog>>(
290 type: K,

Callers

nothing calls this directly

Calls 1

#sendPacketMethod · 0.95

Tested by

no test coverage detected