blob: 8c3c0d2adf16fc8074140d35edceec8c57e8ecd4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
import { Inject, Injectable } from '@nestjs/common';
import Channel from '../channel.js';
class AdminChannel extends Channel {
public readonly chName = 'admin';
public static shouldShare = true;
public static requireCredential = true;
public async init(params: any) {
// Subscribe admin stream
this.subscriber.on(`adminStream:${this.user!.id}`, data => {
this.send(data);
});
}
}
@Injectable()
export class AdminChannelService {
public readonly shouldShare = AdminChannel.shouldShare;
public readonly requireCredential = AdminChannel.requireCredential;
constructor(
) {
}
public create(id: string, connection: Channel['connection']): AdminChannel {
return new AdminChannel(
id,
connection,
);
}
}
|