const cityRepo = new CityRepository();
const mailRepo = new MailRepository();
+const cache: Record<string, any> = {
+ online_users: []
+};
const msgBuffer: string[] = [];
createBullBoard({
server.get<void, string>('/server-stats', async req => {
const date = new Date();
+ const min = date.getMinutes();
return `
<div class="text-right">
- <span class="success-text">${(await server.ws.allSockets()).size} Online</span><br>
+ <span class="success-text">${server.ws.engine.clientsCount} Online</span><br>
<span>
- Server Time: ${date.getHours()}:${date.getMinutes()}
+ Server Time: ${date.getHours()}:${min < 10 ? '0'+min : min}
</span>
</div>`;
});
server.ws.emit('/chat-message', renderPublicChatMessage('Server', `${acct.username} logged in`));
+ cache.online_users.push(acct.username);
+
+ socket.on('disconnect', () => {
+ cache.online_users.splice(cache.online_users.indexOf(acct.username), 1);
+ });
});
server.start();