示例#1
0
        public WebRpcHandler(string baseUrl,
                             Dictionary <string, object> environment, HttpRequestQueue queue,
                             IRpcHandlerAppCounters rpcAppCounters           = null,
                             HttpRequestQueueOptions httpRequestQueueOptions = null)
        {
            this.rpcAppCounters = rpcAppCounters ?? nullAppCounters;
            this.baseUrl        = baseUrl;
            this.environment    = environment;

            if (httpRequestQueueOptions == null)
            {
                httpRequestQueueOptions = new HttpRequestQueueOptions();
            }

            this.httpRequestQueue = queue;
            this.httpRequestQueue.SetCounters(this);

            this.httpRequestQueue.MaxErrorRequests         = httpRequestQueueOptions.HttpQueueMaxTimeouts;
            this.httpRequestQueue.MaxTimedOutRequests      = httpRequestQueueOptions.HttpQueueMaxErrors;
            this.httpRequestQueue.ReconnectInterval        = TimeSpan.FromMilliseconds(httpRequestQueueOptions.HttpQueueReconnectInterval);
            this.httpRequestQueue.QueueTimeout             = TimeSpan.FromMilliseconds(httpRequestQueueOptions.HttpQueueQueueTimeout);
            this.httpRequestQueue.MaxQueuedRequests        = httpRequestQueueOptions.HttpQueueMaxQueuedRequests;
            this.httpRequestQueue.MaxBackoffInMilliseconds = httpRequestQueueOptions.HttpQueueMaxBackoffTime;
            this.httpRequestQueue.MaxConcurrentRequests    = httpRequestQueueOptions.HttpQueueMaxConcurrentRequests;

            this.httpRequestTimeout = httpRequestQueueOptions.HttpQueueRequestTimeout;
        }
        public MasterApplication()
        {
            var env = new Dictionary <string, object>
            {
                { "AppId", this.HwId },
                { "AppVersion", "" },
                { "Region", "" },
                { "Cloud", "" },
            };

            var options = new HttpRequestQueueOptions(
                CommonSettings.Default.WebRpcHttpQueueMaxErrors,
                CommonSettings.Default.WebRpcHttpQueueMaxTimeouts,
                CommonSettings.Default.WebRpcHttpQueueRequestTimeout,
                CommonSettings.Default.WebRpcHttpQueueQueueTimeout,
                CommonSettings.Default.WebRpcHttpQueueMaxBackoffTime,
                CommonSettings.Default.WebRpcHttpQueueReconnectInterval,
                CommonSettings.Default.WebRpcHttpQueueMaxQueuedRequests,
                CommonSettings.Default.WebRpcHttpQueueMaxConcurrentRequests);

            var settings      = WebRpcSettings.Default;
            var webRpcEnabled = (settings != null && settings.Enabled);
            var baseUrlString = webRpcEnabled ? settings.BaseUrl.Value : string.Empty;

            this.webRpcManager = new WebRpcManager(webRpcEnabled, baseUrlString, env, options);
        }
示例#3
0
 public WebRpcHandler(string baseUrl,
                      Dictionary <string, object> environment,
                      IRpcHandlerAppCounters rpcAppCounters           = null,
                      HttpRequestQueueOptions httpRequestQueueOptions = null)
     : this(baseUrl, environment, new HttpRequestQueue(), rpcAppCounters, httpRequestQueueOptions)
 {
 }
示例#4
0
        public WebRpcManager(Dictionary <string, object> environment)
        {
            var settings      = WebRpcSettings.Default;
            var webRpcEnabled = (settings != null && settings.Enabled);
            var baseUrlString = webRpcEnabled ? settings.BaseUrl.Value : string.Empty;

            var options = new HttpRequestQueueOptions(httpQueueReconnectInterval: 60000);

            this.Init(webRpcEnabled, baseUrlString, environment, options);
        }
        public GameApplication()
        {
            AppDomain.CurrentDomain.AssemblyResolve += PluginManager.OnAssemblyResolve;

            this.UpdateMasterEndPoint();

            this.ServerId                  = Guid.NewGuid();
            this.GamingTcpPort             = GameServerSettings.Default.GamingTcpPort;
            this.GamingUdpPort             = GameServerSettings.Default.GamingUdpPort;
            this.GamingWebSocketPort       = GameServerSettings.Default.GamingWebSocketPort;
            this.GamingSecureWebSocketPort = GameServerSettings.Default.GamingSecureWebSocketPort;
            this.GamingHttpPort            = GameServerSettings.Default.GamingHttpPort;
            this.GamingHttpsPort           = GameServerSettings.Default.GamingHttpsPort;
            this.GamingHttpPath            = string.IsNullOrEmpty(GameServerSettings.Default.GamingHttpPath) ? string.Empty : "/" + GameServerSettings.Default.GamingHttpPath;
            this.GamingWebRTCPort          = GameServerSettings.Default.GamingWebRTCPort;

            this.ConnectRetryIntervalSeconds = GameServerSettings.Default.ConnectReytryInterval;

            this.reader = new NodesReader(this.ApplicationRootPath, CommonSettings.Default.NodesFileName);


            var env = new Dictionary <string, object>
            {
                { "AppId", this.HwId },
                { "AppVersion", "" },
                { "Region", "" },
                { "Cloud", "" },
            };

            var options = new HttpRequestQueueOptions(
                CommonSettings.Default.WebRpcHttpQueueMaxErrors,
                CommonSettings.Default.WebRpcHttpQueueMaxTimeouts,
                CommonSettings.Default.WebRpcHttpQueueRequestTimeout,
                CommonSettings.Default.WebRpcHttpQueueQueueTimeout,
                CommonSettings.Default.WebRpcHttpQueueMaxBackoffTime,
                CommonSettings.Default.WebRpcHttpQueueReconnectInterval,
                CommonSettings.Default.WebRpcHttpQueueMaxQueuedRequests,
                CommonSettings.Default.WebRpcHttpQueueMaxConcurrentRequests);

            var settings      = WebRpcSettings.Default;
            var webRpcEnabled = (settings != null && settings.Enabled);
            var baseUrlString = webRpcEnabled ? settings.BaseUrl.Value : string.Empty;

            this.webRpcManager = new WebRpcManager(webRpcEnabled, baseUrlString, env, options);
        }
示例#6
0
        private void Init(bool enabled, string baseUrlString, Dictionary <string, object> env, HttpRequestQueueOptions httpRequestQueueOptions)
        {
            this.environment = env;
            this.baseUrl     = baseUrlString;

            this.httpRequestQueue.MaxErrorRequests         = httpRequestQueueOptions.HttpQueueMaxTimeouts;
            this.httpRequestQueue.MaxTimedOutRequests      = httpRequestQueueOptions.HttpQueueMaxErrors;
            this.httpRequestQueue.ReconnectInterval        = TimeSpan.FromMilliseconds(httpRequestQueueOptions.HttpQueueReconnectInterval);
            this.httpRequestQueue.QueueTimeout             = TimeSpan.FromMilliseconds(httpRequestQueueOptions.HttpQueueQueueTimeout);
            this.httpRequestQueue.MaxQueuedRequests        = httpRequestQueueOptions.HttpQueueMaxQueuedRequests;
            this.httpRequestQueue.MaxBackoffInMilliseconds = httpRequestQueueOptions.HttpQueueMaxBackoffTime;
            this.httpRequestQueue.MaxConcurrentRequests    = httpRequestQueueOptions.HttpQueueMaxConcurrentRequests;

            this.httpQueueRequestTimeout = httpRequestQueueOptions.HttpQueueRequestTimeout;

            this.IsRpcEnabled = enabled;
        }
示例#7
0
 public WebRpcManager(bool enabled, string baseUrl, Dictionary <string, object> environment, HttpRequestQueueOptions httpRequestQueueOptions)
 {
     this.Init(enabled, baseUrl, environment, httpRequestQueueOptions);
 }