public override async Task OnConnectedAsync() { //Close already existing connection for the same account var existingConnection = await _accountService.GetConnection(AccountName); if (existingConnection != null) { await CloseConnection(existingConnection.ConnectionId); } var connection = new ConnectionModel() { ConnectionId = ConnectionId, InstanceName = _instanceName }; await _groupService.AddConnection(connection, AccountName); await base.OnConnectedAsync(); LogDebug($"ConnectionId: {ConnectionId} connected in " + _timer.ElapsedMilliseconds + " ms."); }