Skip to content

Commit

Permalink
βœ” πŸŽ‰ ✨ 😘 πŸ₯° πŸ’˜ 😍
Browse files Browse the repository at this point in the history
  • Loading branch information
bifeldy committed Oct 14, 2023
1 parent 10418ab commit fbea587
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/fansubid/server/main.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/api/gateways/socket-io.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { UserService } from '../repository/user.service';
@WebSocketGateway()
export class SocketIoGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect {

private timeoutSocketConnect = null;

constructor(
private cms: ClusterMasterSlaveService,
private cfg: ConfigService,
Expand All @@ -55,7 +57,11 @@ export class SocketIoGateway implements OnGatewayInit, OnGatewayConnection, OnGa
handleConnection(client: Socket, ...args: any[]) {
this.gs.log('[SOCKET_IO_GATEWAY-CLIENT_CONNECTED] 🌟', client.id);
this.sis.checkNewNotification(client);
setTimeout(async () => {
if (this.timeoutSocketConnect) {
clearTimeout(this.timeoutSocketConnect);
}
this.timeoutSocketConnect = setTimeout(async () => {
this.timeoutSocketConnect = null;
const totalSockets = (await this.sis.getAllClientsSocket()).length;
this.ts.updateVisitor(`πŸƒβ€β™‚οΈ ${totalSockets} Pengunjung`);
this.sis.emitToBroadcast('visitor', totalSockets);
Expand Down

0 comments on commit fbea587

Please sign in to comment.