pollo/src/server/ably.ts
Atridad Lahiji bc40f1a0ac
Maybe this
2023-11-16 21:23:46 -07:00

13 lines
382 B
TypeScript

import Ably from "ably";
import { env } from "~/env.mjs";
import type { EventType } from "../utils/types";
export const publishToChannel = async (
ablyInstance: Ably.Types.RealtimePromise,
channel: string,
event: EventType,
message: string
) => {
const channelName = ablyInstance.channels.get(`${env.APP_ENV}-${channel}`);
await channelName.publish(event, message);
};