<commit_before>﻿using System.Collections.Generic;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;

namespace RElmah.Host.SignalR.Hubs
{
    [HubName("relmah-errors")]
    public class ErrorsHub : Hub
    {
        public void Monitor(IEnumerable<string> apps)
        {
            foreach (var app in apps)
                Groups.Add(Context.ConnectionId, app);
        }
    }
}<commit_msg>Handling dep injection + OnConnected<commit_after>﻿using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;

namespace RElmah.Host.SignalR.Hubs
{
    [HubName("relmah-errors")]
    public class ErrorsHub : Hub
    {
        private readonly IDispatcher _dispatcher;
        private readonly IUserIdProvider _userIdProvider;

        public ErrorsHub(IDispatcher dispatcher, IUserIdProvider userIdProvider)
        {
            _dispatcher = dispatcher;
            _userIdProvider = userIdProvider;
        }

        public override Task OnConnected()
        {
            _dispatcher.Connect( _userIdProvider.GetUserId(Context.Request), a => Groups.Add(Context.ConnectionId, a));

            return base.OnConnected();
        }

        public void Monitor(IEnumerable<string> apps)
        {
            foreach (var app in apps)
                Groups.Add(Context.ConnectionId, app);
        }
    }
}
{'fraction_non_alphanumeric': 0.08941344778254649, 'fraction_numerical': 0.0, 'mean_word_length': 2.5871794871794873, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6979868', 'n_tokens_mistral': 395, 'n_tokens_neox': 396, 'n_words': 81}