feat: implement user session management with Redis and add game token verification

This commit is contained in:
2025-12-30 01:55:40 +00:00
parent 29523ef22f
commit f01a21f2f0
28 changed files with 477 additions and 27 deletions
@@ -0,0 +1,28 @@
export interface GatewayUserFlushEvent {
userId: string;
flushedAt: string;
reason?: string;
}
export interface GatewayFlushPublisher {
publishUserFlush(userId: string, reason?: string): Promise<void>;
}
export class RedisGatewayFlushPublisher implements GatewayFlushPublisher {
private readonly channel: string;
private readonly client: { publish: (channel: string, message: string) => Promise<number> };
constructor(client: { publish: (channel: string, message: string) => Promise<number> }, channel: string) {
this.client = client;
this.channel = channel;
}
async publishUserFlush(userId: string, reason?: string): Promise<void> {
const payload: GatewayUserFlushEvent = {
userId,
flushedAt: new Date().toISOString(),
reason,
};
await this.client.publish(this.channel, JSON.stringify(payload));
}
}