code format
This commit is contained in:
parent
7271649638
commit
919291b032
1 changed files with 37 additions and 39 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Lesser General Public License
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
using Microsoft.AspNet.SignalR;
|
using Microsoft.AspNet.SignalR;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
@ -37,10 +38,10 @@ namespace Yavsc
|
||||||
{
|
{
|
||||||
ApplicationDbContext _dbContext;
|
ApplicationDbContext _dbContext;
|
||||||
ILogger _logger;
|
ILogger _logger;
|
||||||
|
public static ConcurrentDictionary<string, string> ChatUserNames = new ConcurrentDictionary<string, string>();
|
||||||
|
|
||||||
public ChatHub()
|
public ChatHub()
|
||||||
{
|
{
|
||||||
|
|
||||||
var scope = Startup.Services.GetRequiredService<IServiceScopeFactory>().CreateScope();
|
var scope = Startup.Services.GetRequiredService<IServiceScopeFactory>().CreateScope();
|
||||||
|
|
||||||
_dbContext = scope.ServiceProvider.GetService<ApplicationDbContext>();
|
_dbContext = scope.ServiceProvider.GetService<ApplicationDbContext>();
|
||||||
|
|
@ -93,7 +94,6 @@ namespace Yavsc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO var uname = Context.Request.QueryString[Constants.KeyParamChatUserName] ?? "anon";
|
|
||||||
|
|
||||||
await Groups.Add(Context.ConnectionId, Constants.HubGroupAnonymous);
|
await Groups.Add(Context.ConnectionId, Constants.HubGroupAnonymous);
|
||||||
}
|
}
|
||||||
|
|
@ -101,8 +101,6 @@ namespace Yavsc
|
||||||
Clients.Group(Constants.HubGroupAuthenticated).notify(NotificationTypes.Connected, userName);
|
Clients.Group(Constants.HubGroupAuthenticated).notify(NotificationTypes.Connected, userName);
|
||||||
await base.OnConnected();
|
await base.OnConnected();
|
||||||
}
|
}
|
||||||
static ConcurrentDictionary<string, string> ChatUserNames
|
|
||||||
= new ConcurrentDictionary<string, string>();
|
|
||||||
string setUserName()
|
string setUserName()
|
||||||
{
|
{
|
||||||
if (Context.User != null)
|
if (Context.User != null)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue