예제 #1
0
        private void LongPollingDataSource_OnDataReceived(object sender, HttpDataSourceEventArgs e)
        {
            ProcessReceivedData(_longPollingRequest, e);

            // reconnect if still connected:
            ReconnectLongPollingConnection(true);
        }
예제 #2
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);
        }
예제 #3
0
 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);
     }
 }
예제 #4
0
        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));
        }
예제 #5
0
        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"));
            }
        }
예제 #6
0
 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);
     }
 }
예제 #7
0
        private void LongPollingDataSource_OnDataReceived(object sender, HttpDataSourceEventArgs e)
        {
            ProcessReceivedData(_longPollingRequest, e);

            // reconnect if still connected:
            ReconnectLongPollingConnection(true);
        }
예제 #8
0
        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));
        }
예제 #9
0
        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"));
            }
        }
예제 #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);
 }
예제 #11
0
 void source_DataReceived(object sender, HttpDataSourceEventArgs e)
 {
     e.DataSource.DataReceived -= source_DataReceived;
     Signal(true);
 }
예제 #12
0
 /// <summary>
 /// Process failure response from remote server.
 /// </summary>
 public virtual void ProcessFailed(HttpDataSourceEventArgs e)
 {
 }
예제 #13
0
 void source_DataReceived(object sender, HttpDataSourceEventArgs e)
 {
     e.DataSource.DataReceived -= source_DataReceived;
     Signal(true);
 }
예제 #14
0
 /// <summary>
 /// Process failure response from remote server.
 /// </summary>
 public virtual void ProcessFailed(HttpDataSourceEventArgs e)
 {
 }