|
|
@ -15,13 +15,20 @@ import type { OnModuleInit } from '@nestjs/common'; |
|
|
|
import type { JobStatus } from '../../interface/Jobs'; |
|
|
|
import type { JobStatus } from '../../interface/Jobs'; |
|
|
|
|
|
|
|
|
|
|
|
const url = new URL(process.env.NC_PUBLIC_URL || `http://localhost:${process.env.PORT || '8080'}/`) |
|
|
|
const url = new URL(process.env.NC_PUBLIC_URL || `http://localhost:${process.env.PORT || '8080'}/`) |
|
|
|
|
|
|
|
let namespace = url.pathname |
|
|
|
|
|
|
|
if (!namespace.endsWith('/')) { |
|
|
|
|
|
|
|
namespace = namespace + '/jobs'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
namespace = namespace + 'jobs'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@WebSocketGateway({ |
|
|
|
@WebSocketGateway({ |
|
|
|
cors: { |
|
|
|
cors: { |
|
|
|
origin: '*', |
|
|
|
origin: '*', |
|
|
|
allowedHeaders: ['xc-auth'], |
|
|
|
allowedHeaders: ['xc-auth'], |
|
|
|
credentials: true, |
|
|
|
credentials: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
namespace: `${url.pathname}jobs`, |
|
|
|
namespace: namespace, |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class JobsGateway implements OnModuleInit { |
|
|
|
export class JobsGateway implements OnModuleInit { |
|
|
|
constructor(@Inject('JobsService') private readonly jobsService) {} |
|
|
|
constructor(@Inject('JobsService') private readonly jobsService) {} |
|
|
|