Re-work socket and reconnection/status logic
This commit is contained in:
@@ -159,10 +159,13 @@ export class ConnectionMeta {
|
||||
getSpeed = () => this.responseCount ? this.responseTimer / this.responseCount : 0
|
||||
|
||||
getStatus = () => {
|
||||
const socket = this.cxn.socket
|
||||
|
||||
if (this.authStatus === AuthStatus.Unauthorized) return ConnectionStatus.Unauthorized
|
||||
if (this.authStatus === AuthStatus.Forbidden) return ConnectionStatus.Forbidden
|
||||
if (socket.isNew()) return ConnectionStatus.Closed
|
||||
if (this.lastFault && this.lastFault > this.lastOpen) return ConnectionStatus.Error
|
||||
if (this.lastClose > this.lastOpen) return ConnectionStatus.Closed
|
||||
if (socket.isClosed() || socket.isClosing()) return ConnectionStatus.Closed
|
||||
if (this.getSpeed() > 1000) return ConnectionStatus.Slow
|
||||
|
||||
return ConnectionStatus.Ok
|
||||
|
||||
Reference in New Issue
Block a user