fix not ending error correctly

This commit is contained in:
2017-10-09 10:28:18 +02:00
parent 99eca912d3
commit fc2a55bb0d
9 changed files with 24 additions and 7 deletions

View File

@ -66,6 +66,7 @@ export class SmartsocketClient {
})
return done.promise
}
disconnect () {
let done = plugins.smartq.defer()
this.socketConnection.socket.disconnect()
@ -74,6 +75,7 @@ export class SmartsocketClient {
done.resolve()
return done.promise
}
serverCall (functionNameArg: string, dataArg: any) {
let done = plugins.smartq.defer()
let socketRequest = new SocketRequest({

View File

@ -49,7 +49,7 @@ export class SocketConnection {
authenticated: boolean = false
role: SocketRole
smartsocketHost: Smartsocket
socket: any //: SocketIO.Socket | SocketIOClient.Socket
socket: any // SocketIO.Socket | SocketIOClient.Socket
constructor (optionsArg: ISocketConnectionConstructorOptions) {
this.alias = optionsArg.alias
this.authenticated = optionsArg.authenticated
@ -62,6 +62,7 @@ export class SocketConnection {
allSocketConnections.add(this)
this.socket.on('disconnect', () => {
plugins.beautylog.info(`SocketConnection with >alias ${this.alias} on >side ${this.side} disconnected`)
this.socket.disconnect()
allSocketConnections.remove(this)
})
}