public static IConnectionContext Create(IWebSocketConnection webSocket,
                                                IConnectionLifetimeManager lifetimeManager,
                                                ISimpleProtocol simpleProtocol,
                                                IUserIdProvider userIdProvider)
        {
            var connectionId = webSocket.ConnectionInfo.Id.ToString();
            var context      = new ConnectionContext(connectionId, webSocket);

            context.Features.Set(simpleProtocol);
            context.Features.Set(lifetimeManager);
            context.UserIdentifier = userIdProvider.GetUserId(webSocket.ConnectionInfo);
            return(context);
        }
Exemple #2
0
 public HaWebSocketServer(ServiceConfigurationOption option,
                          IConnectionLifetimeManager connectionLifetimeManager,
                          IServiceProvider serviceProvider,
                          IInvokeHandlerManager invokeHandlerManager,
                          IUserIdProvider userIdProvider,
                          ILoggerFactory loggerFactory)
 {
     this.serviceConfigurationOption = option;
     this.connectionLifetimeManager  = connectionLifetimeManager;
     this.innerWebSocketServer       = new WebSocketServer(serviceConfigurationOption.Location);
     this.loggerFactory        = loggerFactory;
     this.simpleProtocol       = serviceProvider.GetRequiredService <ISimpleProtocol>();
     this.invokeHandlerManager = invokeHandlerManager;
     this.logger         = loggerFactory.CreateLogger <HaWebSocketServer>();
     this.userIdProvider = userIdProvider;
 }
 public GroupSendHandler(IConnectionLifetimeManager connectionLifetimeManager)
 {
     this.connectionLifetimeManager = connectionLifetimeManager;
 }
Exemple #4
0
 public static void SetLifetimeManager(this IConnectionContext context, IConnectionLifetimeManager connectionLifetimeManager)
 {
     context.Features.Set(connectionLifetimeManager);
 }
Exemple #5
0
 public TestHandler(IConnectionLifetimeManager connectionLifetimeManager)
 {
     this.connectionLifetimeManager = connectionLifetimeManager;
 }