-
Notifications
You must be signed in to change notification settings - Fork 17
/
pusher.ts
26 lines (23 loc) · 782 Bytes
/
pusher.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import PusherServer from "pusher";
import PusherClient from "pusher-js";
export const pusherEvents = {
NEW_MESSAGE: "messages:new",
UPDATE_MESSAGE: "message:update",
NEW_CONVERSATION: "conversation:new",
UPDATE_CONVERSATION: "conversation:update",
DELETE_CONVERSATION: "conversation:remove",
};
export const pusherServer = new PusherServer({
appId: process.env.PUSHER_APP_ID!,
key: process.env.NEXT_PUBLIC_PUSHER_APP_KEY!,
secret: process.env.PUSHER_SECRET!,
cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER!,
useTLS: true,
});
export const pusherClient = new PusherClient(process.env.NEXT_PUBLIC_PUSHER_APP_KEY!, {
channelAuthorization: {
endpoint: "/api/pusher/auth",
transport: "ajax",
},
cluster: process.env.NEXT_PUBLIC_PUSHER_CLUSTER!,
});