paricafe/src/server/api/endpoints/get-online-users-count.ts

23 lines
391 B
TypeScript
Raw Normal View History

2020-12-29 22:07:16 -06:00
import define from '../define';
import { redisClient } from '../../../db/redis';
2021-03-23 03:43:07 -05:00
import config from '@/config';
2020-12-29 22:07:16 -06:00
export const meta = {
tags: ['meta'],
requireCredential: false as const,
params: {
}
};
export default define(meta, (ps, user) => {
return new Promise((res, rej) => {
redisClient.pubsub('numsub', config.host, (_, x) => {
2020-12-29 22:07:16 -06:00
res({
count: x[1]
});
});
});
});