• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IHubContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IHubContext的典型用法代码示例。如果您正苦于以下问题:C# IHubContext类的具体用法?C# IHubContext怎么用?C# IHubContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IHubContext类属于命名空间,在下文中一共展示了IHubContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ForGame

 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));
     }
 }
开发者ID:davidwhitney,项目名称:StarBastardCore,代码行数:7,代码来源:ClientPushHub.cs


示例2: SignalRLogSink

        public SignalRLogSink(IHubContext context, IFormatProvider formatProvider)
        {
            if (context == null) throw new ArgumentNullException(nameof(context));

            _formatProvider = formatProvider;
            _context = context;
        }
开发者ID:eugene-goldberg,项目名称:StandaloneServiceTemplate,代码行数:7,代码来源:SignalRLogSink.cs


示例3: QueueProcessor

        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);
                }
            });
        }
开发者ID:spencerhakim,项目名称:firetea.ms,代码行数:35,代码来源:QueueProcessor.cs


示例4: SignalR

        /// <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);
        }
开发者ID:eugene-goldberg,项目名称:StandaloneServiceTemplate,代码行数:16,代码来源:SignalRLogSinkExtensions.cs


示例5: DemoHub

 public DemoHub(
     IHubContext<TypedDemoHub, IClient> typedDemoContext,
     IPersistentConnectionContext<RawConnection> rawConnectionContext)
 {
     _typedDemoContext = typedDemoContext;
     _rawConnectionContext = rawConnectionContext;
 }
开发者ID:leloulight,项目名称:SignalR-Server,代码行数:7,代码来源:DemoHub.cs


示例6: DeleteSessionMessageTutor

        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);
                        }
                    }
                }
            }
        }
开发者ID:imranjaved728,项目名称:MezoExpert,代码行数:33,代码来源:StudentsController.cs


示例7: SignalRSink

 /// <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;
 }
开发者ID:RossMerr,项目名称:serilog,代码行数:15,代码来源:SignalRSink.cs


示例8: ProxyWatcher

        private ProxyWatcher(IHubContext context)
        {
            Context = context;

            _GatewayServer.ClientManager.OnClientConnectEvent += ClientManager_OnClientConnectEvent;
            _GatewayServer.ClientManager.OnClientDisconnectEvent += ClientManager_OnClientDisconnectEvent;
            _GatewayServer.ClientManager.OnPairedEvent += ClientManager_OnPairedEvent;
        }
开发者ID:jaganthoutam,项目名称:RemoteDesktop,代码行数:8,代码来源:ProxyWatcher.cs


示例9: Join

        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;
        }
开发者ID:dealproc,项目名称:Drey,代码行数:9,代码来源:GroupMembershipService.cs


示例10: Leave

        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;
        }
开发者ID:dealproc,项目名称:Drey,代码行数:9,代码来源:GroupMembershipService.cs


示例11: GameThread

 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");
 }
开发者ID:ChadMcCallum,项目名称:BuildHackathon,代码行数:9,代码来源:GameThread.cs


示例12: AlarmCheck

 public AlarmCheck(string UserId, string UserName)
 {
     _userId = UserId;
     _userName = UserName;
     _alarmHub = GlobalHost.ConnectionManager.GetHubContext<AlarmHub>();
     StartTimer();
 }
开发者ID:Dierme,项目名称:smartcalendarHELP,代码行数:7,代码来源:AlarmCheck.cs


示例13: ShapeBroadCaster

        public ShapeBroadCaster()
        {
            var broadCastLoop = new Timer(UpdateShape, null, BroadCastInterval, BroadCastInterval);
            shouldUpdateShape = false;

            shapeHub = GlobalHost.ConnectionManager.GetHubContext<MoveShapeHub>();
        }
开发者ID:sujankh,项目名称:LearnSignalR,代码行数:7,代码来源:MoveShapeHub.cs


示例14: BackgroundServerTimeTimer

        public BackgroundServerTimeTimer()
        {
            HostingEnvironment.RegisterObject(this);

            hub = GlobalHost.ConnectionManager.GetHubContext<ClientPushHub>();
            taskTimer = new Timer(OnTimerElapsed, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5));
        }
开发者ID:ChristianWeyer,项目名称:ngSignalR,代码行数:7,代码来源:BackgroundServerTimeTimer.cs


示例15: BackgroundTicker

 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));
 }
开发者ID:bl1nkr,项目名称:AkkaSandbox,代码行数:7,代码来源:StatsHub.cs


示例16: DataEngine

 public DataEngine(int pollIntervalMillis)
 {
     //HostingEnvironment.RegisterObject(this);
     _hubs = GlobalHost.ConnectionManager.GetHubContext<DataHub>();
     _pollIntervalMillis = pollIntervalMillis;
     dataRandom = new Random(DateTime.Now.Millisecond);
 }
开发者ID:mplynch,项目名称:angularRT,代码行数:7,代码来源:DataEngine.cs


示例17: RandomGenerator

 public RandomGenerator(int pollIntervalMillis)
 {
     //HostingEnvironment.RegisterObject(this);
     _hubs = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
     _pollIntervalMillis = pollIntervalMillis;
     _numberRand = new Random();
 }
开发者ID:TkachenkoRoman,项目名称:OwinKatanaServer,代码行数:7,代码来源:RandomGenerator.cs


示例18: SignalRConsole

 public SignalRConsole()
 {
     var url = "http://localhost:8945";
     WebApp.Start<Startup>(url);
     System.Console.WriteLine("Server running on {0}", url);
     _hubContext = GlobalHost.ConnectionManager.GetHubContext<SignalrProxy>();
 }
开发者ID:modulexcite,项目名称:ScriptCs.WebConsole,代码行数:7,代码来源:SignalRConsole.cs


示例19: GameHub

 public GameHub(Game game)
 {
     _game = game;
     _timer = new Timer();
     _timer.Elapsed += CreateGame;
     _context = GlobalHost.ConnectionManager.GetHubContext<GameHub>();
 }
开发者ID:CESI-RIL13,项目名称:KingOfCesi,代码行数:7,代码来源:GameHub.cs


示例20: SignalRActor

 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));
 }
开发者ID:mindis,项目名称:TaxiDemo,代码行数:7,代码来源:SignalRActor.cs



注:本文中的IHubContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IHubIncomingInvokerContext类代码示例发布时间:2022-05-24
下一篇:
C# IHub类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap