public static async Task <JsonRpcServer> From(JsonRpcServerOptions options, CancellationToken cancellationToken)
        {
            var server = new JsonRpcServer(options);

            await server.Initialize(cancellationToken);

            return(server);
        }
示例#2
0
        public JsonRpcServer Get(string name)
        {
            if (_servers.TryGetValue(name, out var server))
            {
                return(server);
            }

            var options = name == Options.DefaultName ? _monitor.CurrentValue : _monitor.Get(name);

            var container = JsonRpcServer.CreateContainer(options, _outerServiceProvider);

            server = container.Resolve <JsonRpcServer>();
            _servers.TryAdd(name, server);

            return(server);
        }
示例#3
0
        public static async Task <IJsonRpcServer> From(JsonRpcServerOptions options)
        {
            var server = new JsonRpcServer(
                options.Input,
                options.Output,
                options.Reciever,
                options.RequestProcessIdentifier,
                options.LoggerFactory,
                options.Serializer,
                options.Services,
                options.HandlerTypes.Select(x => x.Assembly)
                .Distinct().Concat(options.HandlerAssemblies)
                );

            await server.Initialize();

            return(server);
        }