33 lines
838 B
TypeScript
33 lines
838 B
TypeScript
import Module from '../utils/Module'
|
|
|
|
/** Conection informations */
|
|
export default class Client extends Module<{ reconnect: boolean }> {
|
|
|
|
public umount() {
|
|
//TODO: proper disconnect
|
|
}
|
|
|
|
protected mount() {
|
|
this.client.on('connect', () => {
|
|
this.logger.trace('Connected')
|
|
})
|
|
this.client.on('disconnect', packet => {
|
|
this.logger.warn('Disconnected %s' + packet.reason)
|
|
})
|
|
this.client.on('kick_disconnect', packet => {
|
|
this.logger.warn('Kicked %s', packet.reason)
|
|
})
|
|
this.client.on('login', () => {
|
|
this.logger.trace('Logged')
|
|
})
|
|
this.client.on('error', error => {
|
|
this.logger.error('error %o', error)
|
|
})
|
|
}
|
|
|
|
protected getConf() {
|
|
return { reconnect: true }
|
|
}
|
|
|
|
}
|