feat: Implement core Discord features including members list, direct messages, user presence, authentication, and chat UI.
Some checks failed
Build and Release / build-and-release (push) Has been cancelled
Some checks failed
Build and Release / build-and-release (push) Has been cancelled
This commit is contained in:
32
convex/presence.ts
Normal file
32
convex/presence.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { mutation, query } from "./_generated/server";
|
||||
import { components } from "./_generated/api";
|
||||
import { v } from "convex/values";
|
||||
import { Presence } from "@convex-dev/presence";
|
||||
|
||||
const presence = new Presence(components.presence);
|
||||
|
||||
export const heartbeat = mutation({
|
||||
args: {
|
||||
roomId: v.string(),
|
||||
userId: v.string(),
|
||||
sessionId: v.string(),
|
||||
interval: v.number(),
|
||||
},
|
||||
handler: async (ctx, { roomId, userId, sessionId, interval }) => {
|
||||
return await presence.heartbeat(ctx, roomId, userId, sessionId, interval);
|
||||
},
|
||||
});
|
||||
|
||||
export const list = query({
|
||||
args: { roomToken: v.string() },
|
||||
handler: async (ctx, { roomToken }) => {
|
||||
return await presence.list(ctx, roomToken);
|
||||
},
|
||||
});
|
||||
|
||||
export const disconnect = mutation({
|
||||
args: { sessionToken: v.string() },
|
||||
handler: async (ctx, { sessionToken }) => {
|
||||
return await presence.disconnect(ctx, sessionToken);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user