private void LongPollingDataSource_OnDataReceived(object sender, HttpDataSourceEventArgs e)
        {
            ProcessReceivedData(_longPollingRequest, e);

            // reconnect if still connected:
            ReconnectLongPollingConnection(true);
        }
        private void DataSource_OnDataReceived(object sender, HttpDataSourceEventArgs e)
        {
            // say, there the current request is no more needed:
            BayeuxRequest r = _request;

            _request = null;
            ProcessReceivedData(r, e);
        }
 private void LongPollingDataSource_OnDataReceiveFailed(object sender, HttpDataSourceEventArgs e)
 {
     if (_longPollingConnecFailures >= LongPollingConnectRetries)
     {
         Event.Invoke(LongPollingFailed, this, new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription));
     }
     else
     {
         // ignore error and try to reconnect:
         Event.InvokeDelayed(LongPollingRetryDelay, ReconnectLongPollingConnectionAfterFailure, this, e);
     }
 }
        private void DataSource_OnDataReceiveFailed(object sender, HttpDataSourceEventArgs e)
        {
            // say, there the current request is no more needed:
            BayeuxRequest r = _request;

            _request = null;

            if (r != null)
            {
                r.ProcessFailed(e);
            }

            OnDataFailed(new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription));
        }
        private void ProcessReceivedData(BayeuxRequest request, HttpDataSourceEventArgs e)
        {
            IJSonObject jsonData = null;

            try
            {
                // read JSON data:
                jsonData = _jsonReader.ReadAsJSonObject(e.StringData);
                OnDataReceived(new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription, e.StringData, jsonData, null));
            }
            catch (JSonReaderException ex)
            {
                OnDataFailed(new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription, e.StringData, ex));
            }

            if (jsonData != null)
            {
                // process JSON response, in case it is an array of responses:
                if (jsonData.IsArray)
                {
                    foreach (IJSonObject message in jsonData.ArrayItems)
                    {
                        ProcessResponseMessage(request, e.StatusCode, e.StatusDescription, message, e.StringData);
                    }
                }
                else
                {
                    ProcessResponseMessage(request, e.StatusCode, e.StatusDescription, jsonData, e.StringData);
                }
            }
            else
            {
                DebugLog.WriteBayeuxLine("--- No JSON data received from server ---");
                OnDataFailed(new BayeuxConnectionEventArgs(this, HttpStatusCode.NoContent, "No JSON data received"));
            }
        }
 private void LongPollingDataSource_OnDataReceiveFailed(object sender, HttpDataSourceEventArgs e)
 {
     if (_longPollingConnecFailures >= LongPollingConnectRetries)
     {
         Event.Invoke(LongPollingFailed, this, new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription));
     }
     else
     {
         // ignore error and try to reconnect:
         Event.InvokeDelayed(LongPollingRetryDelay, ReconnectLongPollingConnectionAfterFailure, this, e);
     }
 }
        private void LongPollingDataSource_OnDataReceived(object sender, HttpDataSourceEventArgs e)
        {
            ProcessReceivedData(_longPollingRequest, e);

            // reconnect if still connected:
            ReconnectLongPollingConnection(true);
        }
        private void DataSource_OnDataReceiveFailed(object sender, HttpDataSourceEventArgs e)
        {
            // say, there the current request is no more needed:
            BayeuxRequest r = _request;
            _request = null;

            if (r != null)
                r.ProcessFailed(e);

            OnDataFailed(new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription));
        }
        private void ProcessReceivedData(BayeuxRequest request, HttpDataSourceEventArgs e)
        {
            IJSonObject jsonData = null;

            try
            {
                // read JSON data:
                jsonData = _jsonReader.ReadAsJSonObject(e.StringData);
                OnDataReceived(new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription, e.StringData, jsonData, null));
            }
            catch (JSonReaderException ex)
            {
                OnDataFailed(new BayeuxConnectionEventArgs(this, e.StatusCode, e.StatusDescription, e.StringData, ex));
            }

            if (jsonData != null)
            {
                // process JSON response, in case it is an array of responses:
                if (jsonData.IsArray)
                {
                    foreach (IJSonObject message in jsonData.ArrayItems)
                    {
                        ProcessResponseMessage(request, e.StatusCode, e.StatusDescription, message, e.StringData);
                    }
                }
                else
                {
                    ProcessResponseMessage(request, e.StatusCode, e.StatusDescription, jsonData, e.StringData);
                }
            }
            else
            {
                DebugLog.WriteBayeuxLine("--- No JSON data received from server ---");
                OnDataFailed(new BayeuxConnectionEventArgs(this, HttpStatusCode.NoContent, "No JSON data received"));
            }
        }
Esempio n. 10
0
 private void DataSource_OnDataReceived(object sender, HttpDataSourceEventArgs e)
 {
     // say, there the current request is no more needed:
     BayeuxRequest r = _request;
     _request = null;
     ProcessReceivedData(r, e);
 }
Esempio n. 11
0
 void source_DataReceived(object sender, HttpDataSourceEventArgs e)
 {
     e.DataSource.DataReceived -= source_DataReceived;
     Signal(true);
 }
Esempio n. 12
0
 /// <summary>
 /// Process failure response from remote server.
 /// </summary>
 public virtual void ProcessFailed(HttpDataSourceEventArgs e)
 {
 }
Esempio n. 13
0
 void source_DataReceived(object sender, HttpDataSourceEventArgs e)
 {
     e.DataSource.DataReceived -= source_DataReceived;
     Signal(true);
 }
Esempio n. 14
0
 /// <summary>
 /// Process failure response from remote server.
 /// </summary>
 public virtual void ProcessFailed(HttpDataSourceEventArgs e)
 {
 }