public AlarmCheck(string UserId, string UserName) { _userId = UserId; _userName = UserName; _alarmHub = GlobalHost.ConnectionManager.GetHubContext<AlarmHub>(); StartTimer(); }
public ShapeBroadCaster() { var broadCastLoop = new Timer(UpdateShape, null, BroadCastInterval, BroadCastInterval); shouldUpdateShape = false; shapeHub = GlobalHost.ConnectionManager.GetHubContext<MoveShapeHub>(); }
public BackgroundServerTimeTimer() { HostingEnvironment.RegisterObject(this); hub = GlobalHost.ConnectionManager.GetHubContext<ClientPushHub>(); taskTimer = new Timer(OnTimerElapsed, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5)); }
public GameHub(Game game) { _game = game; _timer = new Timer(); _timer.Elapsed += CreateGame; _context = GlobalHost.ConnectionManager.GetHubContext<GameHub>(); }
private static void ForGame(Guid gameId, IHubContext ctx, Action<dynamic> actionOnValidClient) { foreach (var registration in Registry.ClientToGames.Where(x => x.Value == gameId)) { actionOnValidClient(ctx.Clients().Client(registration.Key)); } }
public BackgroundTicker(IHubMessageService hubMessageService) { _hubMessageService = hubMessageService; HostingEnvironment.RegisterObject(this); hub = GlobalHost.ConnectionManager.GetHubContext<StatsHub>(); taskTimer = new Timer(OnTimerElasped, null, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2)); }
public void DeleteSessionMessageTutor(string sessionId, string sendTo, string message, IHubContext context) { //var name = Context.User.Identity.Name; using (var db = new ApplicationDbContext()) { var user = db.Useras.Where(c => c.UserName == sendTo && c.SessionId == sessionId).FirstOrDefault(); if (user == null) { // context.Clients.Caller.showErrorMessage("Could not find that user."); } else { db.Entry(user) .Collection(u => u.Connections) .Query() .Where(c => c.Connected == true) .Load(); if (user.Connections == null) { // Clients.Caller.showErrorMessage("The user is no longer connected."); } else { foreach (var connection in user.Connections) { context.Clients.Client(connection.ConnectionID) .recieverSessionClosed(message); } } } } }
public QueueProcessor(Logger log, IDataStore dataStore, IHubContext<IMatchmakingClient> hub, ITracker tracker, IMatchEvaluator matchBuilder, CircularBuffer<TimeSpan> timeToMatch) { _log = log; _dataStore = dataStore; _hub = hub; _tracker = tracker; _matchBuilder = matchBuilder; _timeToMatch = timeToMatch; _queueSleepMin = Int32.Parse( CloudConfigurationManager.GetSetting("QueueSleepMin") ); _queueSleepMax = Int32.Parse( CloudConfigurationManager.GetSetting("QueueSleepMax") ); _queueSleepLength = Int32.Parse( CloudConfigurationManager.GetSetting("QueueSleepLength") ); Task.Run( async () => { _log.Info("Running QueueProcessor..."); while( true ) { var sleepTime = _queueSleepMax; try { await processQueue(); sleepTime = _queueSleepMax - (_dataStore.DocumentDbPopulation * (_queueSleepMax/_queueSleepLength)); } catch(Exception ex) { _log.Error(ex); } Thread.Sleep(sleepTime < _queueSleepMin ? _queueSleepMin : sleepTime); } }); }
public DemoHub( IHubContext<TypedDemoHub, IClient> typedDemoContext, IPersistentConnectionContext<RawConnection> rawConnectionContext) { _typedDemoContext = typedDemoContext; _rawConnectionContext = rawConnectionContext; }
public SignalRActor() { _chat = GlobalHost.ConnectionManager.GetHubContext<PositionHub>(); Receive<Taxi.PositionBearing>(p => positionChanged(p)); Receive<Taxi.Status>(status => statusChanged(status)); Receive<Publisher.SourceAvailable>(s => sourceChanged(s)); }
public DataEngine(int pollIntervalMillis) { //HostingEnvironment.RegisterObject(this); _hubs = GlobalHost.ConnectionManager.GetHubContext<DataHub>(); _pollIntervalMillis = pollIntervalMillis; dataRandom = new Random(DateTime.Now.Millisecond); }
public SignalRLogSink(IHubContext context, IFormatProvider formatProvider) { if (context == null) throw new ArgumentNullException(nameof(context)); _formatProvider = formatProvider; _context = context; }
/// <summary> /// Adds a sink that writes log events as documents to a SignalR hub. /// /// </summary> /// <param name="loggerConfiguration">The logger configuration.</param><param name="context">The hub context.</param><param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param><param name="batchPostingLimit">The maximum number of events to post in a single batch.</param><param name="period">The time to wait between checking for event batches.</param><param name="formatProvider">Supplies culture-specific formatting information, or null.</param> /// <returns> /// Logger configuration, allowing configuration to continue. /// </returns> /// <exception cref="T:System.ArgumentNullException">A required parameter is null.</exception> public static LoggerConfiguration SignalR(this LoggerSinkConfiguration loggerConfiguration, IHubContext context, LogEventLevel restrictedToMinimumLevel = LogEventLevel.Verbose, int batchPostingLimit = 5, TimeSpan? period = null, IFormatProvider formatProvider = null) { if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration)); if (context == null) throw new ArgumentNullException(nameof(context)); return loggerConfiguration.Sink(new SignalRLogSink(context, formatProvider), restrictedToMinimumLevel); }
public RandomGenerator(int pollIntervalMillis) { //HostingEnvironment.RegisterObject(this); _hubs = GlobalHost.ConnectionManager.GetHubContext<MyHub>(); _pollIntervalMillis = pollIntervalMillis; _numberRand = new Random(); }
public SignalRConsole() { var url = "http://localhost:8945"; WebApp.Start<Startup>(url); System.Console.WriteLine("Server running on {0}", url); _hubContext = GlobalHost.ConnectionManager.GetHubContext<SignalrProxy>(); }
public Broadcaster() { // Obtendo o contexto do hub. _hubContext = GlobalHost.ConnectionManager.GetHubContext<GameHub>(); // ativando atualizações periódicas dos jogadores. _broadcastLoop = new Timer(InformPosition, null, _interval, _interval); }
private SignalRServer() { MessageClient = GlobalHost.ConnectionManager.GetHubContext<MessageHub, IMessageClient>(); TaoItemMessageClient = GlobalHost.ConnectionManager.GetHubContext<ItemMessageHub, ItemMessageClient>(); TaoTradeMessageClient = GlobalHost.ConnectionManager.GetHubContext<TradeMessageHub, ITradeMessageClient>(); TaoRefundMessageClient = GlobalHost.ConnectionManager.GetHubContext<RefundMessageHub, ITaoRefundMessageClient>(); TaoTradeRateMessageClient = GlobalHost.ConnectionManager.GetHubContext<TradeRateMessageHub>(); }
public PresenceMonitor(IKernel kernel, IConnectionManager connectionManager, ITransportHeartbeat heartbeat) { _kernel = kernel; _hubContext = connectionManager.GetHubContext<Chat>(); _heartbeat = heartbeat; }
public static void Start(IConnectionManager connectionManager) { hub = connectionManager.GetHubContext<DashboardHub>(); SystemController.OnStarted += OnSystemControllerStarted; SystemController.OnGatewayConnected += OnGatewayConnected; SystemController.OnGatewayDisconnected += OnGatewayDisconnected; }
public PersonController(IPersonRepository personRepository) { _personRepository = personRepository; _personHubContext = GlobalHost.ConnectionManager.GetHubContext<PersonHub>(); _valueHubContext = GlobalHost.ConnectionManager.GetHubContext<ValueHub>(); CreateTimer(); }
private AlarmCheck(string UserId, string UserName, IRepository repos) { _repository = repos; _userId = UserId; _userName = UserName; _alarmHub = GlobalHost.ConnectionManager.GetHubContext<AlarmHub>(); StartTimer(); }
/// <summary> /// Construct a sink posting to the specified database. /// </summary> /// <param name="context">The hub context.</param> /// <param name="batchPostingLimit">The maximium number of events to post in a single batch.</param> /// <param name="period">The time to wait between checking for event batches.</param> /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param> public SignalRSink(IHubContext context, int batchPostingLimit, TimeSpan period, IFormatProvider formatProvider) : base(batchPostingLimit, period) { if (context == null) throw new ArgumentNullException("context"); _formatProvider = formatProvider; _context = context; }
private ProxyWatcher(IHubContext context) { Context = context; _GatewayServer.ClientManager.OnClientConnectEvent += ClientManager_OnClientConnectEvent; _GatewayServer.ClientManager.OnClientDisconnectEvent += ClientManager_OnClientDisconnectEvent; _GatewayServer.ClientManager.OnPairedEvent += ClientManager_OnPairedEvent; }
public BackgroundTicker() { HostingEnvironment.RegisterObject(this); hub = GlobalHost.ConnectionManager.GetHubContext<MetricHub>(); taskTimer = new Timer(OnTimerElapsed, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(.1)); }
public GameThread(IHubContext context) { _random = new Random(); IsStarted = false; _hub = context; this.Game = new Game(Guid.NewGuid().ToString()); _service = new TwitterService("vCBYBvYAdRrgWs5z0zmD1A", "eHqhut7IVR4aUWlgBwuURl3QssL7ASf7hNIi3AovjY"); _service.AuthenticateWith("68329856-dHYH7dgh85Qkiv7vaNjoScNDTngJtNrjdH8JCLcvt", "KFtWesqC94jxkgSVYrpMlg4IKIcitmJF7MQW0b5Q"); }
public static void Start() { cpuRandom = new Random(30); memoryRandom = new Random(6); //You need to create instance using the GlobalHost, creating a direct instance of your hub would result in to runtime exception hubContext = GlobalHost.ConnectionManager.GetHubContext<StatsHub>(); new Timer(BroadcastStats, null, 1500, 1500); }
public Task Join(IHubContext<Drey.Server.Hubs.IRuntimeClient> hubContext, ClaimsPrincipal principal, string connectionId, Task onConnected) { _log.Info("Joining groups."); hubContext.Groups.Add(connectionId, principal.Identity.Name); _clientRegistry.Add(connectionId, principal.Identity.Name); return onConnected; }
public NotificationLogger(IEventRepository eventRepository, ISkUserRepository skUserRepository, INotificationRepository notificationStudioRepository) { this.eventRepository = eventRepository; this.skUserRepository = skUserRepository; this.notificationRepository = notificationStudioRepository; hub = GlobalHost.ConnectionManager.GetHubContext<NotificationPushHub>(); SkusEventManager.Instance.Subscribe(this, "Publish", OnNewDesignShared); }
public Task Leave(IHubContext<Drey.Server.Hubs.IRuntimeClient> hubContext, ClaimsPrincipal principal, string connectionId, Task onDisconnected) { _log.Info("Leaving groups."); //hubContext.Groups.Remove(connectionId, principal.Identity.Name); _clientRegistry.Remove(connectionId); return onDisconnected; }
public NotifiesController(DBContext context, IHubContext <NotifyHub, ITypedHubClient> hubContext) { dbcontext = context; ihubContext = hubContext; }
public PushNotificationService(IHubContext <PushNotificationHub, IClientPushNotification> pushNotificationHubContext, IOptions <PushNotificationOptions> options) { _pushNotificationHubContext = pushNotificationHubContext; }
public ChatController(IHubContext <ChatHub> hubContext) { _hubContext = hubContext; }
public static async Task HideToast(this IHubContext <DashboardHub> hub, string clientId, string id) { await hub.Clients.Client(clientId).SendAsync("hideToast", id); }
public static async Task RemoveElement(this IHubContext <DashboardHub> hub, string componentId) { await hub.Clients.All.SendAsync("removeElement", componentId); }
public static async Task RequestState(this IHubContext <DashboardHub> hub, string clientId, string componentId, string requestId) { await hub.Clients.Client(clientId).SendAsync("requestState", componentId, requestId); }
public ReservaController(HotelContext context, IHubContext <SignalHub> hubContext) { _reservaService = new ReservaService(context); _hubContext = hubContext; }
public OrderService(FantasyTraderDataContext context, ILogger<OrderService> logger, IHubContext<OrderHub> hub, FantasyMarketPriceSource prices) { _context = context; _logger = logger; _hub = hub; _prices = prices; }
public ClockService(IHubContext <ClockHub> hub) { _clockHubContext = hub; }
public PlayableCharacterController(DungeonsAndDragonsContext context, SessionHandler sessionHandler, IHubContext <DnDHub> hubcontext) { _context = context; _sessionHandler = sessionHandler; _hubcontext = hubcontext; }
public static async Task SetState(this IHubContext <DashboardHub> hub, string clientId, string componentId, Element state) { await hub.Clients.Client(clientId).SendAsync("setState", componentId, state); }
public ConferencesServiceCodeFirst(ILogger <ConferencesServiceCodeFirst> logger, ConferencesDbContext conferencesDbContext, IMapper mapper, IHubContext <ConferencesHub> hubContext) { _logger = logger; _conferencesDbContext = conferencesDbContext; _mapper = mapper; _hubContext = hubContext; }
public NotificationHandlerController(IHubContext <NotificationHub> hubContext) { _hubContext = hubContext; }
public static async Task ClearElement(this IHubContext <DashboardHub> hub, string clientId, string componentId) { await hub.Clients.Client(clientId).SendAsync("clearElement", componentId); }
public EventBus(IMediator mediator, IHubContext <EventsHub> eventsHub) { _mediator = mediator; _eventsHub = eventsHub; }
public static async Task Clipboard(this IHubContext <DashboardHub> hub, string clientId, string Data, bool toastOnSuccess, bool toastOnError) { await hub.Clients.Client(clientId).SendAsync("clipboard", Data, toastOnSuccess, toastOnError); }
public static async Task Redirect(this IHubContext <DashboardHub> hub, string clientId, string url, bool newWindow) { await hub.Clients.Client(clientId).SendAsync("redirect", url, newWindow); }
public NotificationsController(MyDbContext context, IHubContext <BroadcastHub, IHubClient> hubContext) { _context = context; _hubContext = hubContext; }
public static async Task Select(this IHubContext <DashboardHub> hub, string clientId, string ID) { await hub.Clients.Client(clientId).SendAsync("select", ID); }
public static async Task ShowModal(this IHubContext <DashboardHub> hub, string clientId, Modal modal) { await hub.Clients.Client(clientId).SendAsync("showModal", modal); }
public PlayerStateManager(IHubContext <PlayerEventHub> playerHub) { m_PlayerEventHub = playerHub; broadcastTimer = new Timer(new TimerCallback(BroadcastMethod), null, 3000, 20); }
public static async Task AddElement(this IHubContext <DashboardHub> hub, string clientId, string parentComponentId, object[] element) { await hub.Clients.Client(clientId).SendAsync("addElement", parentComponentId, element); }
public MeetingHub(ILogger <MeetingHub> logger, MeetingManager meetingManager, MediasoupOptions mediasoupOptions, IHubContext <MeetingHub, IPeer> hubContext) { _logger = logger; _meetingManager = meetingManager; _mediasoupOptions = mediasoupOptions; _hubContext = hubContext; }
public ProfileController(SignInManager <ApplicationUser> signInManager, UserManager <ApplicationUser> userManager, IActivityLogRepository repox, IHubContext <ChatHub> hub, IWebHostEnvironment env) { this.signInManager = signInManager; this.userManager = userManager; this.repox = repox; this.hub = hub; this.env = env; this.mailServer = new MailServer(); }
public MultiworldController(RandomizerContext context, IHubContext <MultiworldHub> hubContext) { this.context = context; this.hubContext = hubContext; }
public WidgetService(ILogger <WidgetService> logger, DatabaseContext context, IHubContext <WidgetHub> hubContext) { _logger = logger; _context = context; _hubContext = hubContext; }
public static async Task CloseModal(this IHubContext <DashboardHub> hub, string clientId) { await hub.Clients.Client(clientId).SendAsync("closeModal"); }
// PS Host public static async Task Write(this IHubContext <DashboardHub> hub, string clientId, string message, MessageType messageType) { await hub.Clients.Client(clientId).SendAsync("write", message, messageType); }
public RecordService(IRecordRepository recordRepository, LogAppContext logAppContext, IHubContext <NotifyHub, IMesageHubClient> hubContext) { _recordRepository = recordRepository; _context = logAppContext; _recordsValidator = new RecordValidator(); _hubContext = hubContext; }
public static async Task ShowToast(this IHubContext <DashboardHub> hub, object toast) { await hub.Clients.All.SendAsync("showToast", toast); }
public BackgroundPerformanceDataTimer() { HostingEnvironment.RegisterObject(this); hub = GlobalHost.ConnectionManager.GetHubContext<PerformanceDataHub>(); taskTimer = new Timer(OnTimerElapsed, null, 1000, 1000); }