|
|
|
|
@ -18,6 +18,7 @@
|
|
|
|
|
//
|
|
|
|
|
// 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/>.
|
|
|
|
|
|
|
|
|
|
using Microsoft.AspNet.SignalR;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
@ -37,10 +38,10 @@ namespace Yavsc
|
|
|
|
|
{
|
|
|
|
|
ApplicationDbContext _dbContext;
|
|
|
|
|
ILogger _logger;
|
|
|
|
|
public static ConcurrentDictionary<string, string> ChatUserNames = new ConcurrentDictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
public ChatHub()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var scope = Startup.Services.GetRequiredService<IServiceScopeFactory>().CreateScope();
|
|
|
|
|
|
|
|
|
|
_dbContext = scope.ServiceProvider.GetService<ApplicationDbContext>();
|
|
|
|
|
@ -93,7 +94,6 @@ namespace Yavsc
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// TODO var uname = Context.Request.QueryString[Constants.KeyParamChatUserName] ?? "anon";
|
|
|
|
|
|
|
|
|
|
await Groups.Add(Context.ConnectionId, Constants.HubGroupAnonymous);
|
|
|
|
|
}
|
|
|
|
|
@ -101,8 +101,6 @@ namespace Yavsc
|
|
|
|
|
Clients.Group(Constants.HubGroupAuthenticated).notify(NotificationTypes.Connected, userName);
|
|
|
|
|
await base.OnConnected();
|
|
|
|
|
}
|
|
|
|
|
static ConcurrentDictionary<string, string> ChatUserNames
|
|
|
|
|
= new ConcurrentDictionary<string, string>();
|
|
|
|
|
string setUserName()
|
|
|
|
|
{
|
|
|
|
|
if (Context.User != null)
|
|
|
|
|
|