import { MyWebSocket } from "../services/webSocketServer/webSocket" ; export interface IClient { getId ( ) : string ; getToken ( ) : string ; getSocket ( ) : MyWebSocket | null ; setSocket ( socket ) : void ; getLastPing ( ) : number ; setLastPing ( lastPing ) : void ; send < T > ( data ) : void ; } export class Client implements IClient { private readonly id : string ; private readonly token : string ; private socket : MyWebSocket | null = null ; private lastPing : number = new Date ( ) . getTime ( ) ; constructor ( { id , token } ) { this . id = id ; this . token = token ; } public getId ( ) { return this . id ; } public getToken ( ) { return this . token ; } public getSocket ( ) { return this . socket ; } public setSocket ( socket ) { this . socket = socket ; } public getLastPing ( ) { return this . lastPing ; } public setLastPing ( lastPing ) { this . lastPing = lastPing ; } public send < T > ( data ) { this . socket ?. send ( JSON . stringify ( data ) ) ; } }