public ScopeContext(string contextPath, IClientRegistry clientRegistry, IScopeResolver scopeResolver, IServiceInvoker serviceInvoker, IPersistenceStore persistanceStore) { _contextPath = contextPath; _clientRegistry = clientRegistry; _scopeResolver = scopeResolver; _persistanceStore = persistanceStore; _serviceInvoker = serviceInvoker; }
public ScopeContext(string contextPath, IClientRegistry clientRegistry, IScopeResolver scopeResolver, IServiceInvoker serviceInvoker, IPersistenceStore persistanceStore) { this._contextPath = string.Empty; this._contextPath = contextPath; this._clientRegistry = clientRegistry; this._scopeResolver = scopeResolver; this._persistanceStore = persistanceStore; this._serviceInvoker = serviceInvoker; }
public static IWebHostBuilder CreateWebHostBuilder(string[] args, IClientRegistry clientRegistry, IAuthenticator authenticator) => WebHost.CreateDefaultBuilder(args) .ConfigureServices(services => { services.AddSingleton <IClientRegistry>(clientRegistry); services.AddSingleton <IAuthenticator>(authenticator); services.AddSingleton <ConcurrentRegistry <string, string> >(); }) .UseStartup <Startup>();
public SocketHub(IClientRegistry clientRegistry, IAuthenticator authenticator, ConcurrentRegistry <string, string> connectionUserRegistry) { _clientRegistry = clientRegistry; _authenticator = authenticator; _connectionUserRegistry = connectionUserRegistry; _jsonSerializerSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore }; }
public bool Connect(IConnection connection, IScope scope, object[] parameters) { IScope connectionScope = connection.Scope; // Use client registry from scope the client connected to. IClientRegistry clientRegistry = connectionScope.Context.ClientRegistry; IClient client = null; if (connection.IsFlexClient) { if (parameters != null && parameters.Length > 2) { string clientId = parameters[1] as string; client = clientRegistry.GetClient(clientId); } } if (client == null) { // Prefered Client id would be the connection's id. client = clientRegistry.GetClient(connection.ConnectionId); } // We have a context, and a client object.. time to init the conneciton. (connection as BaseConnection).Initialize(client); if (scope.Endpoint != null) { client.Renew(scope.Endpoint.ClientLeaseTime); } else { client.Renew(MessageBroker.GetMessageBroker(MessageBroker.DefaultMessageBrokerId).FlexClientSettings.TimeoutMinutes); } // TODO: we could check for banned clients here FluorineContext.Current.SetSession(connection.Session); FluorineContext.Current.SetClient(client); FluorineContext.Current.SetConnection(connection); //Current objects are set notify listeners. if (FluorineContext.Current.Session != null && FluorineContext.Current.Session.IsNew) { FluorineContext.Current.Session.NotifyCreated(); } if (FluorineContext.Current.Session == null) { return(false); } if (client != null) { client.RegisterSession(FluorineContext.Current.Session); client.NotifyCreated(); } return(true); }
public void Start() { this.RegisterMessageBroker(); this._globalScope = new FluorineFx.Messaging.GlobalScope(); this._globalScope.Name = "default"; ScopeResolver scopeResolver = new ScopeResolver(this._globalScope); IClientRegistry clientRegistry = this._clientManager; ServiceInvoker serviceInvoker = new ServiceInvoker(); ScopeContext context = new ScopeContext("/", clientRegistry, scopeResolver, serviceInvoker, null); CoreHandler handler = new CoreHandler(); this._globalScope.Context = context; this._globalScope.Handler = handler; this._globalScope.Register(); this.StartServices(); this.StartEndpoints(); }
public override void Invoke(AMFContext context) { MessageOutput messageOutput = context.MessageOutput; for (int i = 0; i < context.AMFMessage.BodyCount; i++) { AMFBody amfBody = context.AMFMessage.GetBodyAt(i); //Check for Flex2 messages if (amfBody.IsEmptyTarget) { object content = amfBody.Content; if (content is IList) { content = (content as IList)[0]; } IMessage message = content as IMessage; if (message != null) { Client client = null; HttpSession session = null; if (FluorineContext.Current.Client == null) { IClientRegistry clientRegistry = _endpoint.GetMessageBroker().ClientRegistry; string clientId = message.GetFlexClientId(); if (!clientRegistry.HasClient(clientId)) { lock (clientRegistry.SyncRoot) { if (!clientRegistry.HasClient(clientId)) { client = _endpoint.GetMessageBroker().ClientRegistry.GetClient(clientId) as Client; } } } if (client == null) { client = _endpoint.GetMessageBroker().ClientRegistry.GetClient(clientId) as Client; } FluorineContext.Current.SetClient(client); } session = _endpoint.GetMessageBroker().SessionManager.GetHttpSession(HttpContext.Current); FluorineContext.Current.SetSession(session); //Context initialized, notify listeners. if (session != null && session.IsNew) { session.NotifyCreated(); } if (client != null) { if (session != null) { client.RegisterSession(session); } if (client.IsNew) { client.Renew(_endpoint.ClientLeaseTime); client.NotifyCreated(); } } /* * RemotingConnection remotingConnection = null; * foreach (IConnection connection in client.Connections) * { * if (connection is RemotingConnection) * { * remotingConnection = connection as RemotingConnection; * break; * } * } * if (remotingConnection == null) * { * remotingConnection = new RemotingConnection(_endpoint, null, client.Id, null); * remotingConnection.Initialize(client, session); * } * FluorineContext.Current.SetConnection(remotingConnection); */ } } else { //Flash remoting AMFHeader amfHeader = context.AMFMessage.GetHeader(AMFHeader.AMFDSIdHeader); string amfDSId = null; if (amfHeader == null) { amfDSId = Guid.NewGuid().ToString("D"); ASObject asoObjectDSId = new ASObject(); asoObjectDSId["name"] = AMFHeader.AMFDSIdHeader; asoObjectDSId["mustUnderstand"] = false; asoObjectDSId["data"] = amfDSId;//set AMFHeader headerDSId = new AMFHeader(AMFHeader.RequestPersistentHeader, true, asoObjectDSId); context.MessageOutput.AddHeader(headerDSId); } else { amfDSId = amfHeader.Content as string; } Client client = null; HttpSession session = null; if (FluorineContext.Current.Client == null) { IClientRegistry clientRegistry = _endpoint.GetMessageBroker().ClientRegistry; string clientId = amfDSId; if (!clientRegistry.HasClient(clientId)) { lock (clientRegistry.SyncRoot) { if (!clientRegistry.HasClient(clientId)) { client = _endpoint.GetMessageBroker().ClientRegistry.GetClient(clientId) as Client; } } } if (client == null) { client = _endpoint.GetMessageBroker().ClientRegistry.GetClient(clientId) as Client; } } FluorineContext.Current.SetClient(client); session = _endpoint.GetMessageBroker().SessionManager.GetHttpSession(HttpContext.Current); FluorineContext.Current.SetSession(session); //Context initialized, notify listeners. if (session != null && session.IsNew) { session.NotifyCreated(); } if (client != null) { if (session != null) { client.RegisterSession(session); } if (client.IsNew) { client.Renew(_endpoint.ClientLeaseTime); client.NotifyCreated(); } } } } }
public GroupMembershipService(IClientRegistry<string> clientRegistry) { _clientRegistry = clientRegistry; }
public LoginRequestChecker(IClientRegistry clientRegistry) { _clientRegistry = clientRegistry; }
public LoginController(ILoginRegistry loginRegistry, IClientRegistry clientRegistry) { _loginRegistry = loginRegistry; _requestChecker = new LoginRequestChecker(clientRegistry); }