update smartsocket class to use standard class method definition

This commit is contained in:
2017-07-15 23:16:22 +02:00
parent cccee35f2c
commit 7170e58457
3 changed files with 37 additions and 15 deletions

View File

@ -22,15 +22,19 @@ export class Smartsocket {
}
/**
* starts listening to incling sockets:
* starts listening to incoming sockets:
*/
startServer = () => {
async startServer () {
this.io = plugins.socketIo(this.options.port)
this.io.on('connection', (socketArg) => {
this._handleSocketConnection(socketArg)
})
}
closeServer = () => {
/**
* closes the server
*/
async closeServer () {
this.openSockets.forEach((socketObjectArg: SocketConnection) => {
plugins.beautylog.log(`disconnect socket with >>alias ${socketObjectArg.alias}`)
socketObjectArg.socket.disconnect()