Esempio n. 1
0
        /// <summary>
        /// Start an asynchronous request to an HTTP server, returning a promise that will resolve when
        /// the request is completed or rejected.
        /// </summary>
        ///
        /// <param name="url">
        /// The URL of the remote server
        /// </param>
        /// <param name="options">
        /// The options to use when creating the reqest
        /// </param>
        ///
        /// <returns>
        /// A promise that resolves when the request completes
        /// </returns>

        public static IPromise <ICsqWebResponse> CreateFromUrlAsync(string url, ServerConfig options = null)
        {
            var deferred = When.Deferred <ICsqWebResponse>();
            int uniqueID = AsyncWebRequestManager.StartAsyncWebRequest(url, deferred.Resolve, deferred.Reject, options);

            return(deferred);
        }
Esempio n. 2
0
        /// <summary>
        /// Start an asynchronous request to an HTTP server.
        /// </summary>
        ///
        /// <param name="url">
        /// The URL of the remote server.
        /// </param>
        /// <param name="callbackSuccess">
        /// A delegate to invoke upon successful completion of the request.
        /// </param>
        /// <param name="callbackFail">
        /// A delegate to invoke upon failure.
        /// </param>
        /// <param name="options">
        /// Options to use when creating the request.
        /// </param>
        ///
        /// <returns>
        /// A unique identifier which will be passed through to the response and can be used to assocate
        /// a response with this request.
        /// </returns>

        public static int CreateFromUrlAsync(string url, Action <ICsqWebResponse> callbackSuccess, Action <ICsqWebResponse> callbackFail = null, ServerConfig options = null)
        {
            return(AsyncWebRequestManager.StartAsyncWebRequest(url, callbackSuccess, callbackFail, options));
        }