Merge pull request #8 from jhalitaksoy/feature/isClientOnline
add isClientOnline
This commit is contained in:
commit
f248d8333a
@ -1,7 +1,8 @@
|
||||
export type Bytes = Buffer
|
||||
export type OnMessage = (clientID : string, message : Object) => any
|
||||
export type OnMessage = (clientID: string, message: Object) => any
|
||||
|
||||
export interface RTMT{
|
||||
sendMessage : (clientID : string, channel : string, message : Object) => any
|
||||
listenMessage : (channel : string, callback : OnMessage) => any
|
||||
export interface RTMT {
|
||||
sendMessage: (clientID: string, channel: string, message: Object) => any;
|
||||
listenMessage: (channel: string, callback: OnMessage) => any;
|
||||
isClientOnline(clientID: string): boolean;
|
||||
}
|
||||
@ -126,4 +126,10 @@ export class RTMTWS implements RTMT {
|
||||
//@ts-ignore
|
||||
ws.isAlive = true;
|
||||
}
|
||||
|
||||
isClientOnline(clientID: string): boolean {
|
||||
const ws = this.clients.has(clientID);
|
||||
//@ts-ignore
|
||||
return ws && ws.isAlive;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user