当前位置: 首页>>代码示例>>C#>>正文


C# IConnectionManager.GetHubContext方法代码示例

本文整理汇总了C#中IConnectionManager.GetHubContext方法的典型用法代码示例。如果您正苦于以下问题:C# IConnectionManager.GetHubContext方法的具体用法?C# IConnectionManager.GetHubContext怎么用?C# IConnectionManager.GetHubContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConnectionManager的用法示例。


在下文中一共展示了IConnectionManager.GetHubContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: playerHub

 /// <summary>
 /// Constructs the player hub
 /// </summary>
 /// <param name="manager">The player hub connection manager</param>
 public playerHub(IConnectionManager manager)
 {
     // Make sure the player hub context is avaiable when needed.
     serviceHelpers.playerHubContext = manager.GetHubContext<playerHub>();
     // Create or get the playerSignals instance
     _signals = playerSignals.Instance;
 }
开发者ID:ShVerni,项目名称:RoboRuckus,代码行数:11,代码来源:playerHub.cs

示例2: Start

        public static void Start(IConnectionManager connectionManager)
        {
            hub = connectionManager.GetHubContext<DashboardHub>();

            SystemController.OnStarted += OnSystemControllerStarted;
            SystemController.OnGatewayConnected += OnGatewayConnected;
            SystemController.OnGatewayDisconnected += OnGatewayDisconnected;
        }
开发者ID:nickpirrottina,项目名称:MyNetSensors,代码行数:8,代码来源:DashboardSignalRServer.cs

示例3: PresenceMonitor

 public PresenceMonitor(IKernel kernel,
                        IConnectionManager connectionManager,
                        ITransportHeartbeat heartbeat)
 {
     _kernel = kernel;
     _hubContext = connectionManager.GetHubContext<Chat>();
     _heartbeat = heartbeat;
 }
开发者ID:BrianRosamilia,项目名称:JabbR,代码行数:8,代码来源:PresenceMonitor.cs

示例4: UploadCallbackHandler

 public UploadCallbackHandler(UploadProcessor processor,
                              ContentProviderProcessor resourceProcessor,
                              IConnectionManager connectionManager,
                              IChatService service)
 {
     _processor = processor;
     _resourceProcessor = resourceProcessor;
     _hubContext = connectionManager.GetHubContext<Chat>();
     _service = service;
 }
开发者ID:phillip-haydon,项目名称:JabbR,代码行数:10,代码来源:UploadCallbackHandler.cs

示例5: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app,ILoggerFactory loggerFactory, IHostingEnvironment env,IRuntimeEnvironment runtimeEnv,IConnectionManager connectionManager)
        {
            app.UseStaticFiles();
            app.UseIISPlatformHandler();
            app.UseCors("OpenBookAPI");
            app.UseSwagger();
            app.UseSwaggerUi();
            app.UseSignalR();
            var hubContext = connectionManager.GetHubContext<OpenBookAPI.SignalR.Hubs.LogHub>();
            app.UseJwtBearerAuthentication(options =>
            {
                options.Audience = Configuration["Auth:ClientId"];
                options.Authority = Configuration["Auth:Domain"];
                options.AuthenticationScheme = "Automatic";
                options.RequireHttpsMetadata = false;
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateLifetime = true
                };
            });
            var localLogger = new LoggerConfiguration()
                .WriteTo.Trace()
                .WriteTo.Console().CreateLogger();

            var signalRlogger = new LoggerConfiguration()
                .WriteTo.Sink(new SignalRSink(hubContext, 10))
                .MinimumLevel.Warning()
                .CreateLogger();

            var azureLogger = new LoggerConfiguration()
                .WriteTo.AzureDocumentDB(new System.Uri("https://openbook.documents.azure.com:443/"), "j4Hzifc5HL6z4uNt152t6ECrI5J7peGpSJDlwfkEzn5Vs94pAxf71N3sw3iQS6YneXC0CvxA+MdQjP/GKVbo6A==")
                .MinimumLevel.Warning()
                .CreateLogger();

            if (runtimeEnv.OperatingSystem.Equals("Windows", StringComparison.OrdinalIgnoreCase))
            {
                loggerFactory.AddSerilog(azureLogger);
            }
            if (env.IsDevelopment())
            {
                loggerFactory.AddSerilog(localLogger);
            }

            loggerFactory.AddSerilog(signalRlogger);

            //should go at the end
            app.UseMvc();
        }
开发者ID:reeseoo,项目名称:OpenBookAPI,代码行数:49,代码来源:Startup.cs

示例6: Start

        public static void Start(IConnectionManager connectionManager)
        {
            hub = connectionManager.GetHubContext<LogsHub>();

            SystemController.OnGatewayConnected += OnGatewayConnected;
            SystemController.OnGatewayDisconnected += OnGatewayDisconnected;

            SystemController.logs.OnGatewayLogInfo += OnLogRecord;
            SystemController.logs.OnGatewayLogError += OnLogRecord;
            SystemController.logs.OnGatewayMessageLog += OnLogRecord;
            SystemController.logs.OnGatewayDecodedMessageLog += OnLogRecord;
            SystemController.logs.OnDataBaseLogInfo += OnLogRecord;
            SystemController.logs.OnDataBaseLogError += OnLogRecord;
            SystemController.logs.OnNodesEngineLogInfo += OnLogRecord;
            SystemController.logs.OnNodesEngineLogError += OnLogRecord;
            SystemController.logs.OnNodeLogInfo += OnLogRecord;
            SystemController.logs.OnNodeLogError += OnLogRecord;
            SystemController.logs.OnSystemLogInfo += OnLogRecord;
            SystemController.logs.OnSystemLogError += OnLogRecord;
        }
开发者ID:nickpirrottina,项目名称:MyNetSensors,代码行数:20,代码来源:LogsSignalRServer.cs

示例7: StoreManagerController

 public StoreManagerController(IPartsUnlimitedContext context, IConnectionManager connectionManager, IMemoryCache memoryCache)
 {
     _db = context;
     _annoucementHub = connectionManager.GetHubContext<AnnouncementHub>();
     _cache = memoryCache;
 }
开发者ID:hjgraca,项目名称:PartsUnlimited,代码行数:6,代码来源:StoreManagerController.cs

示例8: HomeModule

        public HomeModule(ApplicationSettings settings,
                          IJabbrConfiguration configuration,
                          UploadCallbackHandler uploadHandler,
                          IConnectionManager connectionManager,
                          IJabbrRepository jabbrRepository)
        {
            Get["/"] = _ =>
            {
                if (IsAuthenticated)
                {
                    var viewModel = new SettingsViewModel
                    {
                        GoogleAnalytics = settings.GoogleAnalytics,
                        Sha = configuration.DeploymentSha,
                        Branch = configuration.DeploymentBranch,
                        Time = configuration.DeploymentTime,
                        DebugMode = (bool)Context.Items["_debugMode"],
                        Version = Constants.JabbRVersion,
                        IsAdmin = Principal.HasClaim(JabbRClaimTypes.Admin),
                        ClientLanguageResources = BuildClientResources()
                    };

                    return View["index", viewModel];
                }

                if (Principal != null && Principal.HasPartialIdentity())
                {
                    // If the user is partially authenticated then take them to the register page
                    return Response.AsRedirect("~/account/register");
                }

                return HttpStatusCode.Unauthorized;
            };

            Get["/monitor"] = _ =>
            {
                ClaimsPrincipal principal = Principal;

                if (principal == null ||
                    !principal.HasClaim(JabbRClaimTypes.Admin))
                {
                    return HttpStatusCode.Forbidden;
                }

                return View["monitor"];
            };

            Get["/status"] = _ =>
            {
                var model = new StatusViewModel();

                // Try to send a message via SignalR
                // NOTE: Ideally we'd like to actually receive a message that we send, but right now
                // that would require a full client instance. SignalR 2.1.0 plans to add a feature to
                // easily support this on the server.
                var signalrStatus = new SystemStatus { SystemName = "SignalR messaging" };
                model.Systems.Add(signalrStatus);

                try
                {
                    var hubContext = connectionManager.GetHubContext<Chat>();
                    var sendTask = (Task)hubContext.Clients.Client("doesn't exist").noMethodCalledThis();
                    sendTask.Wait();

                    signalrStatus.SetOK();
                }
                catch (Exception ex)
                {
                    signalrStatus.SetException(ex.GetBaseException());
                }

                // Try to talk to database
                var dbStatus = new SystemStatus { SystemName = "Database" };
                model.Systems.Add(dbStatus);

                try
                {
                    var roomCount = jabbrRepository.Rooms.Count();
                    dbStatus.SetOK();
                }
                catch (Exception ex)
                {
                    dbStatus.SetException(ex.GetBaseException());
                }

                // Try to talk to storage
                var azureStorageStatus = new SystemStatus { SystemName = "Upload storage" };
                model.Systems.Add(azureStorageStatus);

                try
                {
                    if (!String.IsNullOrEmpty(settings.AzureblobStorageConnectionString))
                    {
                        var azure = new AzureBlobStorageHandler(settings);
                        UploadResult result;
                        using (var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes("test")))
                        {
                            result = azure.UploadFile("statusCheck.txt", "text/plain", stream)
                                          .Result;
                        }
//.........这里部分代码省略.........
开发者ID:CloudMetal,项目名称:JabbR,代码行数:101,代码来源:HomeModule.cs

示例9: CommunicateController

 public CommunicateController(ILogger<CommunicateController> logger, IRepository repository, IConnectionManager connectionManager)
 {
     _logger = logger;
     _repository = repository;
     _comHub = connectionManager.GetHubContext<ComHub>();
 }
开发者ID:Royih,项目名称:BrewMatic.WebApp,代码行数:6,代码来源:CommunicateController.cs

示例10: MessageProcessor

 public MessageProcessor(IConnectionManager connectionManager)
 {
     this.tripsHub = connectionManager.GetHubContext<TripsHub>();
 }
开发者ID:mikhailshilkov,项目名称:etamanager,代码行数:4,代码来源:MessageProcessor.cs

示例11: Start

        public static void Start(IConnectionManager connectionManager)
        {
            hub = connectionManager.GetHubContext<MySensorsHub>();

            SystemController.OnGatewayConnected += OnGatewayConnected;
        }
开发者ID:nickpirrottina,项目名称:MyNetSensors,代码行数:6,代码来源:MySensorsSignalRServer.cs

示例12: NotificationsController

 public NotificationsController(
     IConnectionManager connectionManager)
 {
     this.notificationsHub = connectionManager.GetHubContext<NotificationsHub>();
 }
开发者ID:cangosta,项目名称:MicroservicesExperiment,代码行数:5,代码来源:NotificationsController.cs

示例13: ChatController

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="chatManager">the chat repository manager</param>
 /// <param name="signalRConnectionManager">the SignalR connection manager</param>
 /// <param name="userManager">the Identity user manager</param>
 public ChatController(IChatManager<string, ChatLeUser, Conversation, Attendee, Message, NotificationConnection> chatManager, IConnectionManager signalRConnectionManager, UserManager<ChatLeUser> userManager)
 {
     _chatManager = chatManager;
     _hub = signalRConnectionManager.GetHubContext<ChatHub>();
     _userManager = userManager;
 }
开发者ID:IEvangelist,项目名称:chatle,代码行数:12,代码来源:ChatController.cs

示例14: Start

        public static async Task Start(ILoggerFactory loggerFactory, IConfigurationRoot Configuration,
            IConnectionManager connectionManager)
        {
            if (serialControllerStarted) return;
            serialControllerStarted = true;

            var logger = loggerFactory.CreateLogger("RequestInfoLogger");

            //configure
            string portName = null;
            try
            {
                SerialController.serialPortDebugState = Boolean.Parse(Configuration["SerialPort:DebugState"]);
                SerialController.serialPortDebugTxRx = Boolean.Parse(Configuration["SerialPort:DebugTxRx"]);
                SerialController.enableAutoAssignId = Boolean.Parse(Configuration["Gateway:EnableAutoAssignId"]);
                SerialController.gatewayDebugState = Boolean.Parse(Configuration["Gateway:DebugState"]);
                SerialController.gatewayDebugTxRx = Boolean.Parse(Configuration["Gateway:DebugTxRx"]);

                SerialController.dataBaseEnabled = Boolean.Parse(Configuration["DataBase:Enable"]);
                SerialController.dataBaseConnectionString = Configuration["DataBase:ConnectionString"];
                SerialController.dataBaseWriteInterval = Int32.Parse(Configuration["DataBase:WriteInterval"]);
                SerialController.dataBaseDebugState = Boolean.Parse(Configuration["DataBase:DebugState"]);
                SerialController.dataBaseWriteTxRxMessages = Boolean.Parse(Configuration["DataBase:WriteTxRxMessages"]);
                SerialController.sensorsTasksEnabled = Boolean.Parse(Configuration["SensorsTasks:Enable"]);
                SerialController.sensorsTasksUpdateInterval = Int32.Parse(Configuration["SensorsTasks:UpdateInterval"]);
                SerialController.sensorsLinksEnabled = Boolean.Parse(Configuration["SensorsLinks:Enable"]);
                SerialController.softNodesEnabled = Boolean.Parse(Configuration["SoftNodes:Enable"]);
                SerialController.softNodesPort = Int32.Parse(Configuration["SoftNodes:Port"]);
                SerialController.softNodesDebugTxRx = Boolean.Parse(Configuration["SoftNodes:DebugTxRx"]);
                SerialController.softNodesDebugState = Boolean.Parse(Configuration["SoftNodes:DebugState"]);
                SerialController.logicalNodesEnabled = Boolean.Parse(Configuration["LogicalNodes:Enable"]);
                SerialController.logicalNodesUpdateInterval = Int32.Parse(Configuration["LogicalNodes:UpdateInterval"]);
                SerialController.logicalNodesDebugEngine = Boolean.Parse(Configuration["LogicalNodes:DebugEngine"]);
                SerialController.logicalNodesDebugNodes = Boolean.Parse(Configuration["LogicalNodes:DebugNodes"]);


                portName = Configuration["SerialPort:Name"];
            }
            catch
            {
                Log("ERROR: Bad configuration in appsettings.json file.");
                throw new Exception("Bad configuration in appsettings.json file.");
            }

            if (portName != null)
            {
                SerialController.OnDebugStateMessage += Log;
                SerialController.OnDebugTxRxMessage += Log;

                hub = connectionManager.GetHubContext<ClientsHub>();
                SerialController.gateway.OnMessageRecievedEvent += OnMessageRecievedEvent;
                SerialController.gateway.OnMessageSendEvent += OnMessageSendEvent;
                SerialController.gateway.OnConnectedEvent += OnConnectedEvent;
                SerialController.gateway.OnDisconnectedEvent += OnDisconnectedEvent;
                SerialController.gateway.OnClearNodesListEvent += OnClearNodesListEvent;
                SerialController.gateway.OnNewNodeEvent += OnNewNodeEvent;
                SerialController.gateway.OnNodeUpdatedEvent += OnNodeUpdatedEvent;
                SerialController.gateway.OnNodeLastSeenUpdatedEvent += OnNodeLastSeenUpdatedEvent;
                SerialController.gateway.OnNodeBatteryUpdatedEvent += OnNodeBatteryUpdatedEvent;
                SerialController.gateway.OnSensorUpdatedEvent += OnSensorUpdatedEvent;
                SerialController.gateway.OnNewSensorEvent += OnNewSensorEvent;

                SerialController.logicalNodesEngine.OnNewNodeEvent += OnNewLogicalNodeEvent;
                SerialController.logicalNodesEngine.OnNodeUpdatedEvent += OnLogicalNodeUpdatedEvent;
                SerialController.logicalNodesEngine.OnNodeDeleteEvent += OnLogicalNodeDeleteEvent;
                SerialController.logicalNodesEngine.OnLinksUpdatedEvent += OnLinksUpdatedEvent;
                SerialController.logicalNodesEngine.OnLinkDeleteEvent += OnLinkDeleteEvent;
                SerialController.logicalNodesEngine.OnNewLinkEvent += OnNewLinkEvent;


                //start
                SerialController.Start(portName);

 

            }
        }
开发者ID:cdkisa,项目名称:MyNetSensors,代码行数:77,代码来源:SerialControllerInitializer.cs

示例15: EventController

 public EventController(IConnectionManager connectionManager)
 {
     this.tripsHub = connectionManager.GetHubContext<TripsHub>();
 }
开发者ID:mikhailshilkov,项目名称:etamanager,代码行数:4,代码来源:EventController.cs


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