public XHRRequest(PollingXHR.XHRRequest.RequestOptions options) { this.Method = options.Method ?? "GET"; this.Uri = options.Uri; this.Data = options.Data; this.CookieHeaderValue = options.CookieHeaderValue; this.ExtraHeaders = options.ExtraHeaders; }
protected PollingXHR.XHRRequest Request(PollingXHR.XHRRequest.RequestOptions opts) { if (opts == null) { opts = new PollingXHR.XHRRequest.RequestOptions(); } opts.Uri = this.Uri(); opts.ExtraHeaders = this.ExtraHeaders; PollingXHR.XHRRequest xhrRequest = new PollingXHR.XHRRequest(opts); xhrRequest.On(Transport.EVENT_REQUEST_HEADERS, (IListener) new PollingXHR.EventRequestHeadersListener(this)).On(Transport.EVENT_RESPONSE_HEADERS, (IListener) new PollingXHR.EventResponseHeadersListener(this)); return(xhrRequest); }
protected override void DoWrite(byte[] data, ActionTrigger action) { PollingXHR.XHRRequest.RequestOptions opts = new PollingXHR.XHRRequest.RequestOptions() { Method = "POST", Data = data, CookieHeaderValue = this.Cookie }; LogManager.GetLogger(Global.CallerName("", 0, "")).Info("DoWrite data = " + (object)data); this.sendXhr = this.Request(opts); this.sendXhr.On(Transport.EVENT_SUCCESS, (IListener) new PollingXHR.SendEventSuccessListener(action)); this.sendXhr.On(Transport.EVENT_ERROR, (IListener) new PollingXHR.SendEventErrorListener(this)); this.sendXhr.Create(); }