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); }
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; }
public static void SetLifetimeManager(this IConnectionContext context, IConnectionLifetimeManager connectionLifetimeManager) { context.Features.Set(connectionLifetimeManager); }
public TestHandler(IConnectionLifetimeManager connectionLifetimeManager) { this.connectionLifetimeManager = connectionLifetimeManager; }